getResourceSegment() публичный Метод

Return the resource segment.
public getResourceSegment ( ) : string
Результат string
Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function save(ResourceSegmentBehavior $document)
 {
     $path = $document->getResourceSegment();
     $webspaceKey = $this->documentInspector->getWebspace($document);
     $locale = $this->documentInspector->getLocale($document);
     $segmentKey = null;
     $webspaceRouteRootPath = $this->getWebspaceRouteNodeBasePath($webspaceKey, $locale, $segmentKey);
     try {
         $routeNodePath = $this->loadByContent($this->documentInspector->getNode($document), $webspaceKey, $locale, $segmentKey);
         $routeDocument = $this->documentManager->find($webspaceRouteRootPath . $routeNodePath, $locale, ['rehydrate' => false]);
         $routeDocumentPath = $webspaceRouteRootPath . $routeNodePath;
     } catch (ResourceLocatorNotFoundException $e) {
         $routeDocument = $this->documentManager->create('route');
         $routeDocumentPath = $webspaceRouteRootPath . $path;
     }
     $routeDocument->setTargetDocument($document);
     try {
         $this->documentManager->persist($routeDocument, $locale, ['path' => $routeDocumentPath, 'auto_create' => true, 'override' => true]);
         $this->documentManager->publish($routeDocument, $locale);
     } catch (ItemExistsException $e) {
         throw new ResourceLocatorAlreadyExistsException($document->getResourceSegment(), $routeDocumentPath);
     }
 }
Пример #2
0
 /**
  * Sets the ResourceSegment to the given property of the given document.
  *
  * @param ResourceSegmentBehavior $document
  * @param PropertyMetadata $property
  */
 private function persistDocument(ResourceSegmentBehavior $document, PropertyMetadata $property)
 {
     $document->getStructure()->getProperty($property->getName())->setValue($document->getResourceSegment());
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function save(ResourceSegmentBehavior $document, $userId)
 {
     $path = $document->getResourceSegment();
     $webspaceKey = $this->documentInspector->getWebspace($document);
     $languageCode = $this->documentInspector->getLocale($document);
     try {
         $treeValue = $this->loadByContent($document);
     } catch (ResourceLocatorNotFoundException $e) {
         $treeValue = null;
     }
     if ($treeValue === $path) {
         return false;
     }
     if (!$this->isValid($path, $webspaceKey, $languageCode)) {
         throw new ResourceLocatorNotValidException($path);
     }
     if (!$this->mapper->unique($path, $webspaceKey, $languageCode)) {
         try {
             $treeContent = $this->loadByResourceLocator($path, $webspaceKey, $languageCode);
             // FIXME Required because jackalope-doctrine-dbal does not return references which only exist in the current
             // session. If it would loadByContent would already return some value, which would make this check obsolete.
             if ($treeContent === $this->documentInspector->getUuid($document)) {
                 return false;
             }
             throw new ResourceLocatorAlreadyExistsException($path, $treeContent);
         } catch (ResourceLocatorNotFoundException $exception) {
             // a node exists but is not a resource-locator.
         }
     }
     $this->mapper->save($document);
 }