/** * @param PublishableInterface $data * @param string $event */ public function __construct(PublishableInterface $data, $event) { $this->data = $data; $this->event = $event; $this->publicationUuid = $data->getPublicationUuid(); }
/** * @param PublishableInterface $entity * @param string $eventName * * @throws AccessDeniedException * * @throws FileException */ protected function handlePublication(PublishableInterface $entity, $eventName) { if (!$this->enabled) { return; } $class = $this->publicationEventClass; $event = new $class($entity, $eventName); $serialized = $this->getSerializer()->serialize($event, $this->getFormat()); $f = $this->getFileName($eventName, $entity->getPublicationUuid()); if (false === file_put_contents($f, $serialized)) { throw new FileException("Unable to write to file {$f}"); } }