Inheritance: extends Sulu\Component\DocumentManager\Behavior\Mapping\UuidBehavior, extends Sulu\Component\DocumentManager\Behavior\Mapping\PathBehavior, extends Sulu\Component\Content\Document\Behavior\RobotBehavior, extends Sulu\Component\Content\Document\Behavior\TargetBehavior
Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 protected function supports(CustomUrlBehavior $customUrl)
 {
     return $customUrl->getTargetDocument() !== null;
 }
Ejemplo n.º 2
0
 /**
  * Find or create route-document for given path.
  *
  * @param string $path
  * @param string $locale
  * @param CustomUrlBehavior $document
  * @param string $route
  *
  * @return RouteDocument
  *
  * @throws ResourceLocatorAlreadyExistsException
  */
 protected function findOrCreateRoute($path, $locale, CustomUrlBehavior $document, $route)
 {
     try {
         /** @var RouteDocument $routeDocument */
         $routeDocument = $this->documentManager->find($path, $locale);
     } catch (DocumentNotFoundException $ex) {
         return $this->documentManager->create('custom_url_route');
     }
     if (!$routeDocument instanceof RouteDocument || $routeDocument->getTargetDocument()->getUuid() !== $document->getUuid()) {
         throw new ResourceLocatorAlreadyExistsException($route, $document->getTitle());
     }
     return $routeDocument;
 }