当前位置: 首页>>代码示例>>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;未经允许,请勿转载。