public function review(Borrower $borrower, User $user, $data) { $review = ReviewQuery::create()->filterByBorrower($borrower)->findOne(); if (!$review) { $review = new Review(); $review->setBorrower($borrower)->setCreatedBy($user->getId()); } else { $review->setModifiedBy($user->getId()); } $review->setIsAddressLocatable($data['isAddressLocatable'])->setIsAddressLocatableNote($data['isAddressLocatableNote']); PropelDB::transaction(function () use($review, $borrower) { $review->save(); $borrower->setActivationStatus($review->isCompleted() ? Borrower::ACTIVATION_REVIEWED : Borrower::ACTIVATION_INCOMPLETE); $borrower->save(); }); return $review; }
public function postReply($data, User $user, Borrower $borrower, Comment $parentComment) { $comment = new Comment(); $comment->setUserId($user->getId()); $comment->setMessage($data['message']); $comment->setBorrowerId($borrower->getId()); $comment->setParentId($parentComment->getId()); $comment->setLevel($parentComment->getLevel() + 1); $comment->setRootId($parentComment->getRootId()); $comment->save(); return $comment; }
public function sendLogoutEvent(User $user) { $data = array('$type' => '$logout', '$api_key' => $this->siftScienceKey, '$user_id' => $user->getId(), '$session_id' => $this->sessionId); $this->sendEvent($this->siftScienceUrl, json_encode($data)); }