本文整理汇总了PHP中Invitation::setAcceptedDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Invitation::setAcceptedDate方法的具体用法?PHP Invitation::setAcceptedDate怎么用?PHP Invitation::setAcceptedDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invitation
的用法示例。
在下文中一共展示了Invitation::setAcceptedDate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFromSignup
public static function createFromSignup($data, $refererMember, Invitation $invitation = null, PropelPDO $con)
{
// This functions expects this parameter to be valid!
// E.g. the result from self::validateSignupForm()
$now = time();
if (!$con->beginTransaction()) {
throw new Exception('Could not begin transaction');
}
try {
$member = new Member();
$member->setFirstName($data['firstName'])->setLastName($data['lastName'])->setEmail($data['email'])->setTitle($data['title'])->setCity($data['city'])->setCountry($data['country'])->setAge($data['age'])->setBankRecipient($data['bank_recipient'])->setIban($data['iban'])->setBic($data['bic'])->setPassword($data['password'])->setSignupDate($now);
if ($invitation) {
$member->setType($invitation->getType());
if ($invitation->getFreeSignup()) {
$member->setPaidDate($now);
}
$invitation->setAcceptedDate($now);
}
$member->setRefererMember($refererMember, $con);
$member->save($con);
if ($invitation) {
$invitation->setAcceptedMemberId($member->getId());
$invitation->save($con);
}
if (!$con->commit()) {
throw new Exception('Could not commit transaction');
}
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
return $member;
}
示例2: createFromSignup
public function createFromSignup($data, $referrerMember, \Invitation $invitation = null, \PropelPDO $con)
{
// This functions expects this parameter to be valid!
// E.g. the result from $this->validateSignupForm()
$now = time();
if (!$con->beginTransaction()) {
throw new \Exception('Could not begin transaction');
}
try {
$member = new \Member();
$member->setFirstName($data['firstName'])->setLastName($data['lastName'])->setEmail($data['email'])->setTitle($data['title'])->setCity($data['city'])->setZipCode($data['zip_code'])->setCountry('India')->setAge($data['age'])->setBankRecipient($data['bank_recipient'])->setIban($data['iban'])->setBic($data['bic'])->setPassword($data['password'])->setSignupDate($now)->setBonusIds('{}')->setPaidDate(null)->setIsExtended(1);
$member->setHash(\Member::calcHash($member));
$wasFreeInvitation = false;
if ($invitation) {
$invitationType = $invitation->getType();
$member->setType($invitationType);
// Special case if e.g. director invites another director.
// The referrer of the referrer will be the referrer.
// This is necessary because the same type can not be on same line vertical
// but horizontal. E.g. Director can have more marketing leader under him
// but only Directors next to him (NOT under him)
if ($invitationType > \Member::TYPE_MEMBER && $referrerMember->getType() == $invitationType) {
$referrerMember = $referrerMember->getReferrerMember();
}
$invitation->setAcceptedDate($now);
if ($invitation->getFreeSignup()) {
$member->setFreeInvitation(1);
$wasFreeInvitation = true;
}
// Deprecated code
// if ( $invitation->getType() === \Member::TYPE_SUB_PROMOTER ) {
// $member->setSubPromoterReferral($invitation->getMeta()['promoter_id']);
// }
}
$member->setReferrerMember($referrerMember, $con);
$member->save($con);
$member->setNum($member->getId() + 1000000);
if ($invitation) {
$invitation->setAcceptedMemberId($member->getId());
$invitation->save($con);
if ($wasFreeInvitation) {
$member->onReceivedMemberFee(\Transaction::$BASE_CURRENCY, $now, true, $con);
}
}
if ($wasFreeInvitation) {
\Tbmt\MailHelper::sendFreeSignupConfirm($member);
\Tbmt\MailHelper::sendNewFreeRecruitmentCongrats($referrerMember, $member);
} else {
\Tbmt\MailHelper::sendSignupConfirm($member);
\Tbmt\MailHelper::sendNewRecruitmentCongrats($referrerMember, $member);
}
$member->save($con);
if (!$con->commit()) {
throw new \Exception('Could not commit transaction');
}
} catch (\Exception $e) {
$con->rollBack();
throw $e;
}
return $member;
}