当前位置: 首页>>代码示例>>PHP>>正文


PHP NodeData::getDepth方法代码示例

本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Model\NodeData::getDepth方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeData::getDepth方法的具体用法?PHP NodeData::getDepth怎么用?PHP NodeData::getDepth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\TYPO3CR\Domain\Model\NodeData的用法示例。


在下文中一共展示了NodeData::getDepth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateCacheTags

 /**
  * Generates cache tags to be flushed for a node which is flushed on shutdown.
  *
  * Code duplicated from Neos' ContentCacheFlusher class
  *
  * @param NodeInterface|NodeData $node The node which has changed in some way
  * @return void
  */
 protected function generateCacheTags($node)
 {
     $this->tagsToFlush[ContentCache::TAG_EVERYTHING] = 'which were tagged with "Everything".';
     $nodeTypesToFlush = $this->getAllImplementedNodeTypes($node->getNodeType());
     foreach ($nodeTypesToFlush as $nodeType) {
         /** @var NodeType $nodeType */
         $nodeTypeName = $nodeType->getName();
         $this->tagsToFlush['NodeType_' . $nodeTypeName] = sprintf('which were tagged with "NodeType_%s" because node "%s" has changed and was of type "%s".', $nodeTypeName, $node->getPath(), $node->getNodeType()->getName());
     }
     $this->tagsToFlush['Node_' . $node->getIdentifier()] = sprintf('which were tagged with "Node_%s" because node "%s" has changed.', $node->getIdentifier(), $node->getPath());
     while ($node->getDepth() > 1) {
         $node = $node->getParent();
         if ($node === NULL) {
             break;
         }
         $this->tagsToFlush['DescendantOf_' . $node->getIdentifier()] = sprintf('which were tagged with "DescendantOf_%s" because node "%s" has changed.', $node->getIdentifier(), $node->getPath());
     }
     if ($node instanceof NodeInterface && $node->getContext() instanceof ContentContext) {
         $firstActiveDomain = $node->getContext()->getCurrentSite()->getFirstActiveDomain();
         if ($firstActiveDomain) {
             $this->domainsToFlush[] = $firstActiveDomain->getHostPattern();
         }
     }
 }
开发者ID:christophlehmann,项目名称:MOC.Varnish,代码行数:32,代码来源:ContentCacheFlusherService.php

示例2: getDepth

 /**
  * Returns the level at which this node is located.
  * Counting starts with 0 for "/", 1 for "/foo", 2 for "/foo/bar" etc.
  *
  * @return integer
  * @api
  */
 public function getDepth()
 {
     return $this->nodeData->getDepth();
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:11,代码来源:Node.php

示例3: getDepthReturnsThePathDepthOfTheNode

 /**
  * @test
  */
 public function getDepthReturnsThePathDepthOfTheNode()
 {
     $node = new NodeData('/', $this->mockWorkspace);
     $this->assertEquals(0, $node->getDepth());
     $node = new NodeData('/foo', $this->mockWorkspace);
     $this->assertEquals(1, $node->getDepth());
     $node = new NodeData('/foo/bar', $this->mockWorkspace);
     $this->assertEquals(2, $node->getDepth());
     $node = new NodeData('/foo/bar/baz/quux', $this->mockWorkspace);
     $this->assertEquals(4, $node->getDepth());
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:14,代码来源:NodeDataTest.php


注:本文中的TYPO3\TYPO3CR\Domain\Model\NodeData::getDepth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。