Example #1
0
 /**
  * Determines if the given document is supported by this subscriber.
  *
  * @param HydrateEvent|PublishEvent|PersistEvent $event
  *
  * @return bool
  */
 private function supports($event)
 {
     return $event->getLocale() && $event->getDocument() instanceof WorkflowStageBehavior;
 }
Example #2
0
 /**
  * Creates or updates the route for the document.
  *
  * @param PublishEvent $event
  */
 public function handlePersistRoute(PublishEvent $event)
 {
     /** @var ResourceSegmentBehavior $document */
     $document = $event->getDocument();
     if (!$this->supports($document)) {
         return;
     }
     if (!$event->getLocale()) {
         return;
     }
     if ($document instanceof HomeDocument) {
         return;
     }
     if ($document instanceof RedirectTypeBehavior && $document->getRedirectType() !== RedirectType::NONE) {
         return;
     }
     $this->persistRoute($document);
 }