getIdentifier() public méthode

This UUID is not the same as the technical persistence identifier used by Flow's persistence framework. It is an additional identifier which is unique within the same workspace and is used for tracking the same node in across workspaces. It is okay and recommended to use this identifier for synchronisation purposes as it does not change even if all of the nodes content or its path changes.
public getIdentifier ( ) : string
Résultat string the node's UUID
 /**
  * Schedules flushing of the routing cache entries for the given $node
  * Note that child nodes are flushed automatically because they are tagged with all parents.
  *
  * @param NodeInterface $node The node which has changed in some way
  * @return void
  */
 public function registerNodeChange(NodeInterface $node)
 {
     if (in_array($node->getIdentifier(), $this->tagsToFlush)) {
         return;
     }
     if (!$node->getNodeType()->isOfType('Neos.Neos:Document')) {
         return;
     }
     $this->tagsToFlush[] = $node->getIdentifier();
 }
 /**
  * Adds the given node to the cache for the given path. The node
  * will also be added under it's identifier.
  *
  * @param string $path
  * @param NodeInterface $node
  * @return void
  */
 public function setByPath($path, NodeInterface $node = null)
 {
     $this->nodesByPath[$path] = $node;
     if ($node !== null) {
         $this->nodesByIdentifier[$node->getIdentifier()] = $node;
     }
 }
 /**
  * Register a node change for a later cache flush. This method is triggered by a signal sent via ContentRepository's Node
  * model or the Neos Publishing Service.
  *
  * @param NodeInterface $node The node which has changed in some way
  * @return void
  */
 public function registerNodeChange(NodeInterface $node)
 {
     $this->tagsToFlush[ContentCache::TAG_EVERYTHING] = 'which were tagged with "Everything".';
     $nodeTypesToFlush = $this->getAllImplementedNodeTypes($node->getNodeType());
     foreach ($nodeTypesToFlush as $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());
     $originalNode = $node;
     while ($node->getDepth() > 1) {
         $node = $node->getParent();
         // Workaround for issue #56566 in Neos.ContentRepository
         if ($node === null) {
             break;
         }
         $tagName = 'DescendantOf_' . $node->getIdentifier();
         $this->tagsToFlush[$tagName] = sprintf('which were tagged with "%s" because node "%s" has changed.', $tagName, $originalNode->getPath());
     }
 }
 /**
  * Resolves the given $nodePathOrIdentifier and returns its absolute path and or a boolean if the result directly matches the currently selected node
  *
  * @param string $nodePathOrIdentifier identifier or absolute path for the node to resolve
  * @return bool|string TRUE if the node matches the selected node, FALSE if the corresponding node does not exist. Otherwise the resolved absolute path with trailing slash
  */
 protected function resolveNodePath($nodePathOrIdentifier)
 {
     if ($this->node === null) {
         return true;
     }
     if (preg_match(UuidValidator::PATTERN_MATCH_UUID, $nodePathOrIdentifier) !== 1) {
         return rtrim($nodePathOrIdentifier, '/') . '/';
     }
     if ($this->node->getIdentifier() === $nodePathOrIdentifier) {
         return true;
     }
     $node = $this->getNodeByIdentifier($nodePathOrIdentifier);
     if ($node === null) {
         return false;
     }
     return $node->getPath() . '/';
 }
 /**
  * {@inheritdoc}
  */
 public function createRedirectsForPublishedNode(NodeInterface $node, Workspace $targetWorkspace)
 {
     $nodeType = $node->getNodeType();
     if ($targetWorkspace->getName() !== 'live' || !$nodeType->isOfType('Neos.Neos:Document')) {
         return;
     }
     $context = $this->contextFactory->create(['workspaceName' => 'live', 'invisibleContentShown' => true, 'dimensions' => $node->getContext()->getDimensions()]);
     $targetNode = $context->getNodeByIdentifier($node->getIdentifier());
     if ($targetNode === null) {
         // The page has been added
         return;
     }
     $targetNodeUriPath = $this->buildUriPathForNodeContextPath($targetNode->getContextPath());
     if ($targetNodeUriPath === null) {
         throw new Exception('The target URI path of the node could not be resolved', 1451945358);
     }
     $hosts = $this->getHostnames($node->getContext());
     // The page has been removed
     if ($node->isRemoved()) {
         $this->flushRoutingCacheForNode($targetNode);
         $statusCode = (int) $this->defaultStatusCode['gone'];
         $this->redirectStorage->addRedirect($targetNodeUriPath, '', $statusCode, $hosts);
         return;
     }
     // compare the "old" node URI to the new one
     $nodeUriPath = $this->buildUriPathForNodeContextPath($node->getContextPath());
     // use the same regexp than the ContentContextBar Ember View
     $nodeUriPath = preg_replace('/@[A-Za-z0-9;&,\\-_=]+/', '', $nodeUriPath);
     if ($nodeUriPath === null || $nodeUriPath === $targetNodeUriPath) {
         // The page node path has not been changed
         return;
     }
     $this->flushRoutingCacheForNode($targetNode);
     $statusCode = (int) $this->defaultStatusCode['redirect'];
     $this->redirectStorage->addRedirect($targetNodeUriPath, $nodeUriPath, $statusCode, $hosts);
     $q = new FlowQuery([$node]);
     foreach ($q->children('[instanceof Neos.Neos:Document]') as $childrenNode) {
         $this->createRedirectsForPublishedNode($childrenNode, $targetWorkspace);
     }
 }
 /**
  * Collects metadata attributes used to allow editing of the node in the Neos backend.
  *
  * @param array $attributes
  * @param NodeInterface $node
  * @return array
  */
 protected function addGenericEditingMetadata(array $attributes, NodeInterface $node)
 {
     $attributes['typeof'] = 'typo3:' . $node->getNodeType()->getName();
     $attributes['about'] = $node->getContextPath();
     $attributes['data-node-_identifier'] = $node->getIdentifier();
     $attributes['data-node-__workspace-name'] = $node->getWorkspace()->getName();
     $attributes['data-node-__label'] = $node->getLabel();
     if ($node->getNodeType()->isOfType('Neos.Neos:ContentCollection')) {
         $attributes['rel'] = 'typo3:content-collection';
     }
     // these properties are needed together with the current NodeType to evaluate Node Type Constraints
     // TODO: this can probably be greatly cleaned up once we do not use CreateJS or VIE anymore.
     if ($node->getParent()) {
         $attributes['data-node-__parent-node-type'] = $node->getParent()->getNodeType()->getName();
     }
     if ($node->isAutoCreated()) {
         $attributes['data-node-_name'] = $node->getName();
         $attributes['data-node-_is-autocreated'] = 'true';
     }
     if ($node->getParent() && $node->getParent()->isAutoCreated()) {
         $attributes['data-node-_parent-is-autocreated'] = 'true';
         // we shall only add these properties if the parent is actually auto-created; as the Node-Type-Switcher in the UI relies on that.
         $attributes['data-node-__parent-node-name'] = $node->getParent()->getName();
         $attributes['data-node-__grandparent-node-type'] = $node->getParent()->getParent()->getNodeType()->getName();
     }
     return $attributes;
 }
 /**
  * Method which does the actual work of discarding, includes a protection against endless recursions and
  * multiple discarding of the same node.
  *
  * @param NodeInterface $node The node to discard
  * @param array &$alreadyDiscardedNodeIdentifiers List of node identifiers which already have been discarded during one discardNode() run
  * @return void
  * @throws \Neos\ContentRepository\Exception\WorkspaceException
  */
 protected function doDiscardNode(NodeInterface $node, array &$alreadyDiscardedNodeIdentifiers = [])
 {
     if ($node->getWorkspace()->getBaseWorkspace() === null) {
         throw new WorkspaceException('Nodes in a in a workspace without a base workspace cannot be discarded.', 1395841899);
     }
     if ($node->getPath() === '/') {
         return;
     }
     if (array_search($node->getIdentifier(), $alreadyDiscardedNodeIdentifiers) !== false) {
         return;
     }
     $alreadyDiscardedNodeIdentifiers[] = $node->getIdentifier();
     $possibleShadowNodeData = $this->nodeDataRepository->findOneByMovedTo($node->getNodeData());
     if ($possibleShadowNodeData instanceof NodeData) {
         if ($possibleShadowNodeData->getMovedTo() !== null) {
             $parentBasePath = $node->getPath();
             $affectedChildNodeDataInSameWorkspace = $this->nodeDataRepository->findByParentAndNodeType($parentBasePath, null, $node->getWorkspace(), null, false, true);
             foreach ($affectedChildNodeDataInSameWorkspace as $affectedChildNodeData) {
                 /** @var NodeData $affectedChildNodeData */
                 $affectedChildNode = $this->nodeFactory->createFromNodeData($affectedChildNodeData, $node->getContext());
                 $this->doDiscardNode($affectedChildNode, $alreadyDiscardedNodeIdentifiers);
             }
         }
         $this->nodeDataRepository->remove($possibleShadowNodeData);
     }
     $this->nodeDataRepository->remove($node);
     $this->emitNodeDiscarded($node);
 }
 /**
  * Set the "context node" this operation was working on.
  *
  * @param NodeInterface $node
  * @return void
  */
 public function setNode(NodeInterface $node)
 {
     $this->nodeIdentifier = $node->getIdentifier();
     $this->workspaceName = $node->getContext()->getWorkspaceName();
     $this->dimension = $node->getContext()->getDimensions();
     $context = $node->getContext();
     if ($context instanceof ContentContext && $context->getCurrentSite() !== null) {
         $siteIdentifier = $this->persistenceManager->getIdentifierByObject($context->getCurrentSite());
     } else {
         $siteIdentifier = null;
     }
     $this->data = Arrays::arrayMergeRecursiveOverrule($this->data, array('nodeContextPath' => $node->getContextPath(), 'nodeLabel' => $node->getLabel(), 'nodeType' => $node->getNodeType()->getName(), 'site' => $siteIdentifier));
     $node = self::getClosestAggregateNode($node);
     if ($node !== null) {
         $this->documentNodeIdentifier = $node->getIdentifier();
         $this->data = Arrays::arrayMergeRecursiveOverrule($this->data, array('documentNodeContextPath' => $node->getContextPath(), 'documentNodeLabel' => $node->getLabel(), 'documentNodeType' => $node->getNodeType()->getName()));
     }
 }
 /**
  * Retrieves the given node's corresponding node in the base workspace (that is, which would be overwritten if the
  * given node would be published)
  *
  * @param NodeInterface $modifiedNode
  * @return NodeInterface
  */
 protected function getOriginalNode(NodeInterface $modifiedNode)
 {
     $baseWorkspaceName = $modifiedNode->getWorkspace()->getBaseWorkspace()->getName();
     $contextProperties = $modifiedNode->getContext()->getProperties();
     $contextProperties['workspaceName'] = $baseWorkspaceName;
     $contentContext = $this->contextFactory->create($contextProperties);
     return $contentContext->getNodeByIdentifier($modifiedNode->getIdentifier());
 }
 /**
  * Returns the NodeData instance with the given identifier from the target workspace.
  * If no NodeData instance is found, null is returned.
  *
  * @param NodeInterface $node
  * @param Workspace $targetWorkspace
  * @return NodeData
  */
 protected function findNodeDataInTargetWorkspace(NodeInterface $node, Workspace $targetWorkspace)
 {
     $nodeData = $this->nodeDataRepository->findOneByIdentifier($node->getIdentifier(), $targetWorkspace, $node->getDimensions());
     return $nodeData === null || $nodeData->getWorkspace() === $targetWorkspace ? $nodeData : null;
 }
 /**
  * returns a specific view node of an master plugin
  * or NULL if it does not exist
  *
  * @param NodeInterface $node
  * @param string $viewName
  * @return NodeInterface
  */
 public function getPluginViewNodeByMasterPlugin(NodeInterface $node, $viewName)
 {
     /** @var $context ContentContext */
     $context = $node->getContext();
     foreach ($this->getNodes(['Neos.Neos:PluginView'], $context) as $pluginViewNode) {
         /** @var NodeInterface $pluginViewNode */
         if ($pluginViewNode->isRemoved()) {
             continue;
         }
         if ($pluginViewNode->getProperty('plugin') === $node->getIdentifier() && $pluginViewNode->getProperty('view') === $viewName) {
             return $pluginViewNode;
         }
     }
     return null;
 }