Beispiel #1
1
 function processLenderInvite(Lender $invitee, InviteVisit $lenderInviteVisit)
 {
     $con = Propel::getWriteConnection(TransactionTableMap::DATABASE_NAME);
     for ($retry = 0; $retry < 3; $retry++) {
         $con->beginTransaction();
         try {
             $invite = $lenderInviteVisit->getInvite();
             if ($invite) {
                 $res1 = $invite->setInvitee($invitee)->save();
             } else {
                 $invite = new Invite();
                 $invite->setLender($lenderInviteVisit->getLender());
                 $invite->setEmail($invitee->getUser()->getEmail());
                 $invite->setInvitee($invitee);
                 $invite->setInvited(false);
                 $res1 = $invitee->save($con);
             }
             if (!$res1) {
                 throw new \Exception();
             }
             $this->transactionService->addLenderInviteTransaction($con, $invite);
         } catch (\Exception $e) {
             $con->rollback();
         }
         $con->commit();
         //TODO , invite_notify(see below commented if statement)
         //   if ($lender['invite_notify']) {
         $this->lenderMailer->sendLenderInviteCredit($invite);
         // }
         $this->mixpanelService->trackInviteAccept($invite);
         return $invite;
     }
     return false;
 }