/** * @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(); }
/** * Decorate hook with required metadata. * * @param Hook $hook */ private function decorateHook(Hook $hook) { $owningSide = $this->storage->getRuntimeMetaByEventName($hook->getName()); if ($owningSide) { $hook->setAreaId($owningSide['areaid']); if (!$hook->getCaller()) { $hook->setCaller($owningSide['owner']); } } }