/** * @param Email $email */ public function __construct(Stat $stat, $request, $firstTime = false) { $this->entity = $stat; $this->email = $stat->getEmail(); $this->request = $request; $this->firstTime = $firstTime; }
/** * @param Stat $stat * @param $reason * @param string $tag * @param bool $flush */ public function setDoNotContact(Stat $stat, $reason, $tag = 'bounced', $flush = true) { $lead = $stat->getLead(); $email = $stat->getEmail(); $address = $stat->getEmailAddress(); $repo = $this->getRepository(); if (!$repo->checkDoNotEmail($address)) { $dnc = new DoNotEmail(); if ($email != null) { $dnc->setEmail($email); } $dnc->setLead($lead); $dnc->setEmailAddress($address); $dnc->setDateAdded(new \DateTime()); $dnc->{"set" . ucfirst($tag)}(); $dnc->setComments($reason); $em = $this->factory->getEntityManager(); $em->persist($dnc); if ($flush) { $em->flush(); } } }
/** * @param Stat $stat * @param $comments * @param int $reason * @param bool $flush * * @return bool|DoNotContact */ public function setDoNotContact(Stat $stat, $comments, $reason = DoNotContact::BOUNCED, $flush = true) { $lead = $stat->getLead(); if ($lead instanceof Lead) { $email = $stat->getEmail(); $channel = $email ? ['email' => $email->getId()] : 'email'; return $this->leadModel->addDncForLead($lead, $channel, $comments, $reason, $flush); } return false; }
/** * @param Stat $stat * @param string $comments * @param string $reason * @param bool $flush */ public function setDoNotContact(Stat $stat, $comments, $reason = 'bounced', $flush = true) { $lead = $stat->getLead(); if ($lead instanceof Lead) { /** @var \Mautic\LeadBundle\Model\LeadModel $leadModel */ $leadModel = $this->factory->getModel('lead.lead'); $email = $stat->getEmail(); $channel = $email ? array('email' => $email->getId()) : 'email'; $leadModel->addDncForLead($lead, $channel, $comments, $reason, $flush); } }
/** * @param Email $email */ public function __construct(Stat $stat, $request) { $this->entity = $stat; $this->email = $stat->getEmail(); $this->request = $request; }
/** * {@inheritDoc} */ public function getEmail() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getEmail', array()); return parent::getEmail(); }