/** * @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(); } } }
/** * {@inheritDoc} */ public function getEmailAddress() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getEmailAddress', array()); return parent::getEmailAddress(); }