/** * Finds subscriber without opt-in mail sent before * * @param Comment $comment * * @return object */ public function findForSubscriptionMail(Comment $comment) { $query = $this->createQuery(); $query->getQuerySettings()->setIgnoreEnableFields(TRUE); $query->matching($query->logicalAnd($query->equals('postUid', $comment->getPostId()), $query->equals('email', $comment->getEmail()), $query->equals('lastSent', 0), $query->equals('hidden', 1), $query->equals('deleted', 0))); return $query->execute()->getFirst(); }
/** * Add a subscriber * * @param Comment $comment * * @return Subscriber */ protected function addSubscriber(Comment $comment) { /* @var $newSubscriber Subscriber */ $newSubscriber = $this->objectManager->get('TYPO3\\T3extblog\\Domain\\Model\\Subscriber', $comment->getPostId()); $newSubscriber->setEmail($comment->getEmail()); $newSubscriber->setName($comment->getAuthor()); $this->subscriberRepository->add($newSubscriber); $this->persistToDatabase(TRUE); $this->log->dev('Added subscriber uid=' . $newSubscriber->getUid()); return $newSubscriber; }