/** * @param Hook $hook * * @return HookedObjectEntity */ public function getByHookOrCreate(Hook $hook) { $entity = $this->findOneBy(['module' => $hook->getCaller(), 'areaId' => $hook->getAreaId(), 'objectId' => $hook->getId()]); if ($entity) { return $entity; } return new HookedObjectEntity($hook); }
public function __construct(Hook $hook) { $this->setModule($hook->getCaller()); $this->setAreaId($hook->getAreaId()); $this->setObjectId($hook->getId()); if ($hook instanceof ProcessHook || $hook instanceof DisplayHook) { $this->setUrlObject($hook->getUrl()); } $this->licenses = new ArrayCollection(); $this->hookedObjectCollections = new ArrayCollection(); $this->hookedObjectMedia = new ArrayCollection(); }