當前位置: 首頁>>代碼示例>>PHP>>正文


PHP NodeInterface::getReferences方法代碼示例

本文整理匯總了PHP中PHPCR\NodeInterface::getReferences方法的典型用法代碼示例。如果您正苦於以下問題:PHP NodeInterface::getReferences方法的具體用法?PHP NodeInterface::getReferences怎麽用?PHP NodeInterface::getReferences使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PHPCR\NodeInterface的用法示例。


在下文中一共展示了NodeInterface::getReferences方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: initialize

 /**
  * {@inheritdoc}
  */
 protected function initialize()
 {
     if (true === $this->initialized) {
         return;
     }
     $references = $this->node->getReferences();
     // TODO: Performance: calling getParent adds overhead when the collection is
     //       initialized, but if we don't do this, we won't know how many items are in the
     //       collection, as one node could have many referring properties.
     foreach ($references as $reference) {
         /* @var PropertyInterface $reference */
         $referrerNode = $reference->getParent();
         $this->documents[$referrerNode->getIdentifier()] = $referrerNode;
     }
     $this->initialized = true;
 }
開發者ID:hason,項目名稱:sulu-document-manager,代碼行數:19,代碼來源:ReferrerCollection.php

示例2: changePathToHistory

 /**
  * changes path node to history node.
  *
  * @param NodeInterface    $node
  * @param SessionInterface $session
  * @param string           $absSrcPath
  * @param string           $absDestPath
  */
 private function changePathToHistory(NodeInterface $node, SessionInterface $session, $absSrcPath, $absDestPath)
 {
     // get new path node
     $relPath = str_replace($absSrcPath, '', $node->getPath());
     $newPath = PathHelper::normalizePath($absDestPath . $relPath);
     $newPathNode = $session->getNode($newPath);
     // set history to true and set content to new path
     $node->setProperty('sulu:content', $newPathNode);
     $node->setProperty('sulu:history', true);
     // get referenced history
     /** @var PropertyInterface $property */
     foreach ($node->getReferences('sulu:content') as $property) {
         $property->getParent()->setProperty('sulu:content', $newPathNode);
     }
 }
開發者ID:ollietb,項目名稱:sulu,代碼行數:23,代碼來源:PhpcrMapper.php

示例3: iterateRouteNodes

 /**
  * Iterates over all route nodes assigned by the given node, and executes the callback on it.
  *
  * @param NodeInterface $node
  * @param callable $callback will be called foreach route node (stops and return value if not false)
  * @param string $webspaceKey
  * @param string $languageCode
  * @param string $segmentKey
  *
  * @return \PHPCR\NodeInterface
  */
 private function iterateRouteNodes(NodeInterface $node, $callback, $webspaceKey, $languageCode, $segmentKey = null)
 {
     if ($node->isNew()) {
         return;
     }
     $routePath = $this->sessionManager->getRoutePath($webspaceKey, $languageCode);
     // search for references with name 'content'
     foreach ($node->getReferences('sulu:content') as $ref) {
         if ($ref instanceof \PHPCR\PropertyInterface) {
             $routeNode = $ref->getParent();
             if (0 !== strpos($routeNode->getPath(), $routePath)) {
                 continue;
             }
             $resourceLocator = $this->getResourceLocator($ref->getParent()->getPath(), $webspaceKey, $languageCode, $segmentKey);
             $result = $callback($resourceLocator, $routeNode);
             if (false !== $result) {
                 return $result;
             }
         }
     }
     return;
 }
開發者ID:sulu,項目名稱:sulu,代碼行數:33,代碼來源:PhpcrMapper.php

示例4: getReferences

 /**
  * {@inheritdoc}
  */
 public function getReferences($name = null)
 {
     return $this->node->getReferences($name);
 }
開發者ID:sulu,項目名稱:sulu,代碼行數:7,代碼來源:SuluNode.php

示例5: removeReferencesForNode

 /**
  * @param $node
  */
 private function removeReferencesForNode(NodeInterface $node)
 {
     $references = $node->getReferences();
     foreach ($references as $reference) {
         $referrer = $reference->getParent();
         $metadata = $this->metadataFactory->getMetadataForPhpcrNode($referrer);
         if ($metadata->getClass() === RouteDocument::class) {
             continue;
         }
         $this->dereferenceProperty($node, $reference);
     }
 }
開發者ID:sulu,項目名稱:sulu,代碼行數:15,代碼來源:StructureRemoveSubscriber.php


注:本文中的PHPCR\NodeInterface::getReferences方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。