![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/app/bundles/CoreBundle/Event/ |
<?php namespace Mautic\CoreBundle\Event; use Doctrine\ORM\EntityManagerInterface; use Mautic\LeadBundle\Entity\Lead; use Symfony\Contracts\EventDispatcher\Event; class CommonEvent extends Event { /** * @var EntityManagerInterface */ protected $em; /** * @var object */ protected $entity; /** * @var bool */ protected $isNew = true; /** * @var bool|array */ protected $changes; /** * @var string */ protected $failed; /** * Sets the entity manager for the event to use. * * @param EntityManagerInterface $em */ public function setEntityManager($em): void { $this->em = $em; } /** * Returns if a saved lead is new or not. * * @return bool */ public function isNew() { return $this->isNew; } public function setFailed(string $reason): void { $this->failed = $reason; } /** * Gets changes to original entity. * * @return mixed */ public function getChanges() { if (null === $this->changes) { $this->changes = false; if ($this->entity && method_exists($this->entity, 'getChanges')) { $this->changes = $this->entity->getChanges(); // Reset changes if (method_exists($this->entity, 'resetChanges')) { $this->entity->resetChanges(); } } } return $this->changes; } /** * @return Lead|null */ public function getLead() { if (method_exists($this->entity, 'getLead')) { return $this->entity->getLead(); } return null; } }