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


PHP NodeInterface::getIdentifier方法代码示例

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


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

示例1: write

 /**
  * {@inheritdoc}
  */
 public function write(NodeInterface $node, PropertyInterface $property, $userId, $webspaceKey, $languageCode, $segmentKey)
 {
     $value = $property->getValue();
     if ($node->getIdentifier() !== null && $value === $node->getIdentifier()) {
         throw new \InvalidArgumentException('Internal link node cannot reference itself');
     }
     parent::write($node, $property, $userId, $webspaceKey, $languageCode, $segmentKey);
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:11,代码来源:SingleInternalLink.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->contentMapper = $this->prophesize('Sulu\\Component\\Content\\Mapper\\ContentMapperInterface');
     $this->requestAnalyzer = $this->prophesize('Sulu\\Component\\Webspace\\Analyzer\\RequestAnalyzerInterface');
     $this->contentTypeManager = $this->prophesize('Sulu\\Component\\Content\\ContentTypeManagerInterface');
     $this->structureManager = $this->prophesize('Sulu\\Component\\Content\\Compat\\StructureManagerInterface');
     $this->sessionManager = $this->prophesize('Sulu\\Component\\PHPCR\\SessionManager\\SessionManagerInterface');
     $this->session = $this->prophesize('PHPCR\\SessionInterface');
     $this->node = $this->prophesize('PHPCR\\NodeInterface');
     $this->parentNode = $this->prophesize('PHPCR\\NodeInterface');
     $this->startPageNode = $this->prophesize('PHPCR\\NodeInterface');
     $webspace = new Webspace();
     $webspace->setKey('sulu_test');
     $locale = new Localization();
     $locale->setCountry('us');
     $locale->setLanguage('en');
     $this->requestAnalyzer->getWebspace()->willReturn($webspace);
     $this->requestAnalyzer->getCurrentLocalization()->willReturn($locale);
     $this->contentTypeManager->get('text_line')->willReturn(new TextLine(''));
     $this->sessionManager->getSession()->willReturn($this->session->reveal());
     $this->sessionManager->getContentNode('sulu_test')->willReturn($this->startPageNode->reveal());
     $this->session->getNodeByIdentifier('123-123-123')->willReturn($this->node->reveal());
     $this->session->getNodeByIdentifier('321-321-321')->willReturn($this->parentNode->reveal());
     $this->node->getIdentifier()->willReturn('123-123-123');
     $this->node->getParent()->willReturn($this->parentNode->reveal());
     $this->node->getDepth()->willReturn(4);
     $this->parentNode->getIdentifier()->willReturn('321-321-321');
     $this->parentNode->getDepth()->willReturn(3);
     $this->startPageNode->getDepth()->willReturn(3);
     $this->structureResolver = new StructureResolver($this->contentTypeManager->reveal(), $this->structureManager->reveal());
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:32,代码来源:ContentTwigExtensionTest.php

示例3: testRestore

 public function testRestore()
 {
     $session = $this->sessionManager->getSession();
     $rootNode = $session->getNode('/cmf/sulu_io/routes/de');
     // create routes for content
     $this->rlpMapper->save($this->content2, '/news', 'sulu_io', 'de');
     $this->rlpMapper->save($this->content1, '/news/news-1', 'sulu_io', 'de');
     // FIXME  issue: https://github.com/jackalope/jackalope/issues/227
     // FIXME  pr: https://github.com/jackalope/jackalope/pull/228
     //        $this->rlpMapper->save($this->content1, '/news/news-1/sub-1', 'sulu_io', 'de');
     //        $this->rlpMapper->save($this->content1, '/news/news-1/sub-2', 'sulu_io', 'de');
     //
     //        $this->rlpMapper->save($this->content1, '/news/news-2', 'sulu_io', 'de');
     //        $this->rlpMapper->save($this->content1, '/news/news-2/sub-1', 'sulu_io', 'de');
     //        $this->rlpMapper->save($this->content1, '/news/news-2/sub-2', 'sulu_io', 'de');
     $session->save();
     // move route
     $this->rlpMapper->move('/news', '/asdf', 'sulu_io', 'de');
     $session->save();
     $session->refresh(false);
     // move route
     $this->rlpMapper->move('/asdf', '/test', 'sulu_io', 'de');
     $session->save();
     $session->refresh(false);
     // load history
     $result = $this->rlpMapper->loadHistoryByContentUuid($this->content2->getIdentifier(), 'sulu_io', 'de');
     $this->assertEquals(2, count($result));
     $news = $rootNode->getNode('news');
     $news1 = $rootNode->getNode('news/news-1');
     $test = $rootNode->getNode('test');
     $test1 = $rootNode->getNode('test/news-1');
     // before
     $this->assertTrue($news->getPropertyValue('sulu:history'));
     $this->assertEquals($test, $news->getPropertyValue('sulu:content'));
     $this->assertTrue($news1->getPropertyValue('sulu:history'));
     $this->assertEquals($test1, $news1->getPropertyValue('sulu:content'));
     $this->assertFalse($test->getPropertyValue('sulu:history'));
     $this->assertEquals($this->content2, $test->getPropertyValue('sulu:content'));
     $this->assertFalse($test1->getPropertyValue('sulu:history'));
     $this->assertEquals($this->content1, $test1->getPropertyValue('sulu:content'));
     sleep(1);
     $this->rlpMapper->restoreByPath('/news', 'sulu_io', 'de');
     // after
     $this->assertFalse($news->getPropertyValue('sulu:history'));
     $this->assertEquals($this->content2, $news->getPropertyValue('sulu:content'));
     $this->assertTrue($news1->getPropertyValue('sulu:history'));
     $this->assertEquals($test1, $news1->getPropertyValue('sulu:content'));
     $this->assertTrue($test->getPropertyValue('sulu:history'));
     $this->assertEquals($news, $test->getPropertyValue('sulu:content'));
     $this->assertFalse($test1->getPropertyValue('sulu:history'));
     $this->assertEquals($this->content1, $test1->getPropertyValue('sulu:content'));
     // load history
     $result = $this->rlpMapper->loadHistoryByContentUuid($this->content2->getIdentifier(), 'sulu_io', 'de');
     $this->assertEquals(2, count($result));
     $this->assertEquals('/test', $result[0]->getResourceLocator());
     $this->assertTrue($result[0]->getCreated() > $result[1]->getCreated());
     $this->assertEquals('/asdf', $result[1]->getResourceLocator());
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:58,代码来源:PhpcrMapperTest.php

示例4: transform

 /**
  * Transform a node into a uuid
  *
  * @param \PHPCR\NodeInterface|null $node
  *
  * @return string|null the uuid to the node or null if $node is null
  *
  * @throws UnexpectedTypeException if given value is not a PHPCR\NodeInterface
  */
 public function transform($node)
 {
     if (null === $node) {
         return null;
     }
     if (!$node instanceof NodeInterface) {
         throw new UnexpectedTypeException($node, 'PHPCR\\NodeInterface');
     }
     return $node->getIdentifier();
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:19,代码来源:PHPCRNodeToUuidTransformer.php

示例5: upgradeNode

 /**
  * Upgrades the node to new URL representation.
  *
  * @param NodeInterface $node The node to be upgraded
  * @param string $locale The locale of the node to be upgraded
  * @param array $properties The properties which are or contain URL fields
  * @param bool $addScheme Adds the scheme to URLs if true, removes the scheme otherwise
  */
 private function upgradeNode(NodeInterface $node, $locale, array $properties, $addScheme)
 {
     /** @var BasePageDocument $document */
     $document = $this->documentManager->find($node->getIdentifier(), $locale);
     $documentLocales = $this->documentInspector->getLocales($document);
     if (!in_array($locale, $documentLocales)) {
         return;
     }
     foreach ($properties as $property) {
         $propertyValue = $document->getStructure()->getProperty($property['property']->getName());
         if ($property['property'] instanceof BlockMetadata) {
             $this->upgradeBlockProperty($property['property'], $property['components'], $propertyValue, $addScheme);
         } else {
             $this->upgradeProperty($propertyValue, $addScheme);
         }
     }
     $this->documentManager->persist($document, $locale);
 }
开发者ID:ollietb,项目名称:sulu,代码行数:26,代码来源:Version201511240844.php

示例6: loadByNode

 /**
  * {@inheritdoc}
  */
 public function loadByNode(NodeInterface $node, $locale, $webspaceKey = null, $excludeGhost = true, $loadGhostContent = false, $excludeShadow = true)
 {
     $document = $this->loadDocument($node->getIdentifier(), $locale, array('load_ghost_content' => $loadGhostContent, 'exclude_ghost' => $excludeGhost, 'exclude_shadow' => $excludeShadow));
     return $this->documentToStructure($document);
 }
开发者ID:kriswillis,项目名称:sulu,代码行数:8,代码来源:ContentMapper.php

示例7: performNodeRemove

 /**
  * Remove the item at absPath from local cache and keep information for undo.
  *
  * @param string $absPath The absolute path of the item that is being
  *      removed. Note that contrary to removeItem(), this path is the full
  *      path for a property too.
  * @param NodeInterface $node             The item that is being removed
  * @param bool          $sessionOperation whether the node removal should be
  *      dispatched immediately or needs to be scheduled in the operations log
  *
  * @see ObjectManager::removeItem()
  */
 protected function performNodeRemove($absPath, NodeInterface $node, $sessionOperation = true, $cascading = false)
 {
     if (!$sessionOperation && !$cascading) {
         $this->transport->deleteNodeImmediately($absPath);
     }
     unset($this->objectsByUuid[$node->getIdentifier()]);
     unset($this->objectsByPath['Node'][$absPath]);
     if ($sessionOperation) {
         // keep reference to object in case of refresh
         $operation = new RemoveNodeOperation($absPath, $node);
         $this->nodesRemove[$absPath] = $operation;
         if (!$cascading) {
             $this->operationsLog[] = $operation;
         }
     }
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:28,代码来源:ObjectManager.php

示例8: mapUrl

 /**
  * @param SessionInterface $session
  * @param NodeInterface    $node
  *
  * @return bool|string FALSE if not mapped, string if url is mapped
  */
 protected function mapUrl(SessionInterface $session, NodeInterface $node)
 {
     $phpcrClass = $node->getPropertyValue('phpcr:class');
     if (!is_subclass_of($phpcrClass, 'Symfony\\Cmf\\Component\\Routing\\RouteReferrersReadInterface')) {
         return false;
     }
     try {
         $url = $this->router->generate(null, array('content_id' => $node->getIdentifier()));
     } catch (RouteNotFoundException $e) {
         return false;
     }
     return $url;
 }
开发者ID:symfony-cmf,项目名称:search-bundle,代码行数:19,代码来源:SearchController.php

示例9: exportSystemViewRecursive

 /**
  * Recursively output node and all its children into the file in the system
  * view format
  *
  * @param NodeInterface $node   the node to output
  * @param resource      $stream The stream resource (i.e. acquired with fopen) to
  *      which the XML serialization of the subgraph will be output. Must
  *      support the fwrite method.
  * @param boolean $skipBinary A boolean governing whether binary properties
  *      are to be serialized.
  * @param boolean $noRecurse A boolean governing whether the subgraph at
  *      absPath is to be recursed.
  * @param boolean $root Whether this is the root node of the resulting
  *      document, meaning the namespace declarations have to be included in
  *      it.
  */
 private static function exportSystemViewRecursive(NodeInterface $node, NamespaceRegistryInterface $ns, $stream, $skipBinary, $noRecurse, $root = false)
 {
     fwrite($stream, '<sv:node');
     if ($root) {
         self::exportNamespaceDeclarations($ns, $stream);
     }
     fwrite($stream, ' sv:name="' . (0 === $node->getDepth() ? 'jcr:root' : htmlspecialchars($node->getName())) . '">');
     // the order MUST be primary type, then mixins, if any, then jcr:uuid if its a referenceable node
     fwrite($stream, '<sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>' . htmlspecialchars($node->getPropertyValue('jcr:primaryType')) . '</sv:value></sv:property>');
     if ($node->hasProperty('jcr:mixinTypes')) {
         fwrite($stream, '<sv:property sv:name="jcr:mixinTypes" sv:type="Name" sv:multiple="true">');
         foreach ($node->getPropertyValue('jcr:mixinTypes') as $type) {
             fwrite($stream, '<sv:value>' . htmlspecialchars($type) . '</sv:value>');
         }
         fwrite($stream, '</sv:property>');
     }
     if ($node->isNodeType('mix:referenceable')) {
         fwrite($stream, '<sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>' . $node->getIdentifier() . '</sv:value></sv:property>');
     }
     foreach ($node->getProperties() as $name => $property) {
         /** @var $property \PHPCR\PropertyInterface */
         if ($name == 'jcr:primaryType' || $name == 'jcr:mixinTypes' || $name == 'jcr:uuid') {
             // explicitly handled before
             continue;
         }
         if (PropertyType::BINARY == $property->getType() && $skipBinary) {
             // do not output binary data in the xml
             continue;
         }
         fwrite($stream, '<sv:property sv:name="' . htmlentities($name) . '" sv:type="' . PropertyType::nameFromValue($property->getType()) . '"' . ($property->isMultiple() ? ' sv:multiple="true"' : '') . '>');
         $values = $property->isMultiple() ? $property->getString() : array($property->getString());
         foreach ($values as $value) {
             if (PropertyType::BINARY == $property->getType()) {
                 $val = base64_encode($value);
             } else {
                 $val = htmlspecialchars($value);
                 //TODO: can we still have invalid characters after this? if so base64 and property, xsi:type="xsd:base64Binary"
             }
             fwrite($stream, "<sv:value>{$val}</sv:value>");
         }
         fwrite($stream, "</sv:property>");
     }
     if (!$noRecurse) {
         foreach ($node as $child) {
             if (!($child->getDepth() == 1 && NodeHelper::isSystemItem($child))) {
                 self::exportSystemViewRecursive($child, $ns, $stream, $skipBinary, $noRecurse);
             }
         }
     }
     fwrite($stream, '</sv:node>');
 }
开发者ID:viral810,项目名称:ngSimpleCMS,代码行数:67,代码来源:ImportExport.php

示例10: upgradeNode

 /**
  * Upgrades the node to new date representation.
  *
  * @param NodeInterface $node The node to be upgraded
  * @param string $locale The locale of the node to be upgraded
  * @param array $properties The properties which are or contain date fields
  * @param bool $up
  */
 private function upgradeNode(NodeInterface $node, $locale, array $properties, $up)
 {
     /** @var BasePageDocument $document */
     $document = $this->documentManager->find($node->getIdentifier(), $locale);
     $documentLocales = $this->documentInspector->getLocales($document);
     if (!in_array($locale, $documentLocales)) {
         return;
     }
     foreach ($properties as $property) {
         if ($property['property'] instanceof BlockMetadata) {
             $this->upgradeBlockProperty($property['property'], $property['components'], $node, $locale, $up);
         } else {
             $this->upgradeProperty($property['property'], $node, $locale, $up);
         }
     }
     $this->documentManager->persist($document, $locale, ['auto_name' => false]);
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:25,代码来源:Version201511240843.php

示例11: write

 /**
  * {@inheritdoc}
  */
 public function write(NodeInterface $node, PropertyInterface $property, $userId, $webspaceKey, $languageCode, $segmentKey)
 {
     $value = $property->getValue();
     if ($value instanceof ArrayableInterface) {
         $value = $value->toArray();
     }
     if (isset($value)) {
         // remove not existing ids
         $session = $node->getSession();
         $selectedNodes = $session->getNodesByIdentifier($value);
         $ids = [];
         foreach ($selectedNodes as $selectedNode) {
             if ($selectedNode->getIdentifier() === $node->getIdentifier()) {
                 throw new \InvalidArgumentException('You are not allowed to link a page to itself!');
             }
             $ids[] = $selectedNode->getIdentifier();
         }
         $value = $ids;
     }
     // set value to node
     $node->setProperty($property->getName(), $value, PropertyType::REFERENCE);
 }
开发者ID:sulu,项目名称:sulu,代码行数:25,代码来源:InternalLinks.php

示例12: dereferenceProperty

 /**
  * Remove the given property, or the value which references the node (when
  * multi-valued).
  *
  * @param NodeInterface     $node
  * @param PropertyInterface $property
  */
 private function dereferenceProperty(NodeInterface $node, PropertyInterface $property)
 {
     if (false === $property->isMultiple()) {
         $property->remove();
         return;
     }
     // dereference from multi-valued referring properties
     $values = $property->getValue();
     foreach ($values as $i => $referencedNode) {
         if ($referencedNode->getIdentifier() === $node->getIdentifier()) {
             unset($values[$i]);
         }
     }
     $property->getParent()->setProperty($property->getName(), $values);
 }
开发者ID:ollietb,项目名称:sulu,代码行数:22,代码来源:StructureRemoveSubscriber.php

示例13: getIdentifier

 /**
  * {@inheritdoc}
  */
 public function getIdentifier()
 {
     return $this->node->getIdentifier();
 }
开发者ID:sulu,项目名称:sulu,代码行数:7,代码来源:SuluNode.php

示例14: upgradeNode

 /**
  * Upgrades the node to new URL representation.
  *
  * @param NodeInterface $node The node to be upgraded
  * @param string $locale The locale of the node to be upgraded
  * @param array $properties The properties which are or contain URL fields
  * @param bool $addScheme Adds the scheme to URLs if true, removes the scheme otherwise
  */
 private function upgradeNode(NodeInterface $node, $locale, $properties, $addScheme)
 {
     /** @var BasePageDocument $document */
     $document = $this->documentManager->find($node->getIdentifier(), $locale);
     $documentLocales = $this->documentInspector->getLocales($document);
     if (!in_array($locale, $documentLocales)) {
         return;
     }
     foreach ($properties as $property) {
         $this->upgradeProperty($document->getStructure()->getProperty($property), $addScheme);
     }
     $this->documentManager->persist($document, $locale);
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:21,代码来源:Version201510210733.php

示例15: getDocumentForNode

 /**
  * Return the document for the given managed node.
  *
  * @param NodeInterface $node
  *
  * @throws \RuntimeException If the node is not managed
  */
 public function getDocumentForNode(NodeInterface $node)
 {
     $identifier = $node->getIdentifier();
     $this->assertNodeExists($identifier);
     return $this->nodeDocumentMap[$identifier];
 }
开发者ID:hason,项目名称:sulu-document-manager,代码行数:13,代码来源:DocumentRegistry.php


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