Sulu\Bundle\SnippetBundle\Snippet\SnippetRepository::getReferences PHP Method

getReferences() public method

Return the nodes which refer to the structure with the given UUID.
public getReferences ( string $uuid ) : PHPCR\NodeInterface[]
$uuid string
return PHPCR\NodeInterface[]
    public function getReferences($uuid)
    {
        $session = $this->sessionManager->getSession();
        $node = $session->getNodeByIdentifier($uuid);
        return iterator_to_array($node->getReferences());
    }

Usage Example

Esempio n. 1
0
 /**
  * Deletes an existing Snippet.
  *
  * @param Request $request
  * @param string $uuid
  *
  * @return JsonResponse
  */
 public function deleteSnippetAction(Request $request, $uuid)
 {
     $webspaceKey = $request->query->get('webspace', null);
     $references = $this->snippetRepository->getReferences($uuid);
     if (count($references) > 0) {
         $force = $request->headers->get('SuluForceRemove', false);
         if ($force) {
             $this->contentMapper->delete($uuid, $webspaceKey, true);
         } else {
             return $this->getReferentialIntegrityResponse($webspaceKey, $references);
         }
     } else {
         $this->contentMapper->delete($uuid, $webspaceKey);
     }
     return new JsonResponse();
 }
All Usage Examples Of Sulu\Bundle\SnippetBundle\Snippet\SnippetRepository::getReferences