Exemplo n.º 1
0
 /**
  * @param Event                                    $event
  * @param Campaign                                 $campaign
  * @param \Mautic\LeadBundle\Entity\Lead|null      $lead
  * @param \Mautic\CoreBundle\Entity\IpAddress|null $ipAddress
  * @param bool                                     $systemTriggered
  *
  * @return LeadEventLog
  * @throws \Doctrine\ORM\ORMException
  */
 public function getLogEntity($event, $campaign, $lead = null, $ipAddress = null, $systemTriggered = false)
 {
     $log = new LeadEventLog();
     if ($ipAddress == null) {
         // Lead triggered from system IP
         $ipAddress = $this->factory->getIpAddress();
     }
     $log->setIpAddress($ipAddress);
     if (!$event instanceof Event) {
         $event = $this->em->getReference('MauticCampaignBundle:Event', $event);
     }
     $log->setEvent($event);
     if (!$campaign instanceof Campaign) {
         $campaign = $this->em->getReference('MauticCampaignBundle:Campaign', $campaign);
     }
     $log->setCampaign($campaign);
     if ($lead == null) {
         /** @var \Mautic\LeadBundle\Model\LeadModel $leadModel */
         $leadModel = $this->factory->getModel('lead');
         $lead = $leadModel->getCurrentLead();
     }
     $log->setLead($lead);
     $log->setDateTriggered(new \DateTime());
     $log->setSystemTriggered($systemTriggered);
     // Save some RAM for batch processing
     unset($event, $campaign, $lead);
     return $log;
 }
 /**
  * {@inheritDoc}
  */
 public function setSystemTriggered($systemTriggered)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setSystemTriggered', array($systemTriggered));
     return parent::setSystemTriggered($systemTriggered);
 }