Node
class Node implements NodeInterface, CacheAwareInterface, TraversableNodeInterface (View source)
This is the main API for storing and retrieving content in the system.
Properties
protected NodeData | $nodeData | The NodeData entity this version is for. |
|
protected Context | $context | ||
protected bool | $nodeDataIsMatchingContext | Defines if the NodeData represented by this Node is already in the same context or if it is currently just "shining through". |
|
protected NodeDataRepository | $nodeDataRepository | ||
protected NodeFactory | $nodeFactory | ||
protected PropertyMapper | $propertyMapper | ||
protected ContextFactoryInterface | $contextFactory | ||
protected NodeServiceInterface | $nodeService | ||
protected NodeMoveIntegrityCheckService | $nodeMoveIntegrityCheckService |
Methods
Returns the absolute path of this node with additional context information (such as the workspace name).
Set the name of the node to $newName, keeping its position as it is.
Sets the absolute path of this node.
Checks if the given node path is available for this node, so either no node with this path exists or an existing node has the same identifier.
Moves a node and sub nodes to the new path.
Moves a node and sub nodes to the new path given with special logic for aggregate node types.
Moves a NodeData object that is either a variant or child node to the given destination path.
Create a node for the given NodeData, given that it is a variant of the current node
Moves the given variant or child node to the destination defined by the given path which is the new path for the originally moved (parent|variant) node
Moves the given node to the destination path by modifying the underlaying NodeData object.
Get other variants of this node (with different dimension values)
No description
No description
No description
Returns the node label as generated by the configured node label generator
Returns the workspace this node is contained in
Sets the index of this node
Returns the index of this node which determines the order among siblings with the same parent node.
Whether or not the node is the root node (i.e. has no parent node)
Moves this node before the given node
Moves this node after the given node
Internal method to do the actual copying.
Sets the specified property.
If this node has a property with the given name.
Returns the specified property.
Maps the property value (an array of node identifiers) to the Node objects if needed.
Removes the specified property.
Returns all properties of this node.
Returns the names of all properties of this node.
Returns the node type of this node.
Creates, adds and returns a child node of this node. Also sets default properties and creates default subnodes.
Creates, adds and returns a child node of this node, without setting default properties or creating subnodes. Only used internally.
Checks if the given Node $name is configured as auto-created childNode in the NodeType configuration.
Creates and persists a node from the given $nodeTemplate as child node
Returns all direct child nodes of this node.
Returns the number of child nodes a similar getChildNodes() call would return.
Removes this node and all its child nodes. This is an alias for setRemoved(true)
Enables using the remove method when only setters are available
If this node is a removed node.
Sets the "hidden" flag for this node.
Returns the current state of the hidden flag
Sets the date and time when this node becomes potentially visible.
Returns the date and time before which this node will be automatically hidden.
Sets the date and time when this node should be automatically hidden
Returns the date and time after which this node will be automatically hidden.
Sets if this node should be hidden in indexes, such as a site navigation.
If this node should be hidden in indexes
Tells if a node, in general, has access restrictions, independent of the current security context.
Tells if this node is "visible".
Tells if this node may be accessed according to the current security context.
Returns the context this node operates in.
Materialize the node data either shallow or with child nodes depending on how we materialize (workspace or dimensions).
Materializes the original node data (of a different workspace) into the current workspace. And unlike the shallow counterpart does that for all auto-created child nodes as well.
Materializes the original node data (of a different workspace) into the current workspace.
Create a recursive copy of this node below $referenceNode with $nodeName.
The NodeData matches the context if the workspace matches exactly.
No description
For internal use in createRecursiveCopy.
No description
Returns a string which distinctly identifies this object and thus can be used as an identifier for cache entries related to this object.
Return the assigned content dimensions of the node.
Given a context a new node is returned that is like this node, but lives in the new context.
Internal method
Checks if the given $nodeType would be allowed as a child node of this node according to the configured constraints.
Determine if this node is configured as auto-created childNode of the parent node. If that is the case, it should not be deleted.
Whether or not this node is tethered to its parent, fka auto created child node
Set the status of the associated NodeData in regards to the Context.
No description
No description
No description
No description
No description
No description
No description
Retrieves and returns the node's path to its root node.
Returns all direct child nodes of this node.
Returns the number of direct child nodes of this node from its subgraph.
Retrieves and returns all nodes referenced by this node from its subgraph.
Retrieves and returns nodes referenced by this node by name from its subgraph.
Retrieves and returns nodes referencing this node from its subgraph.
Retrieves and returns nodes referencing this node by name from its subgraph.
No description
No description
Signals that the node path has been changed.
Signals that a node will be created.
Signals that the property of a node will be changed.
Signals that the property of a node was changed.
For debugging purposes, the node can be converted to a string.
Details
string
getContextPath()
Returns the absolute path of this node with additional context information (such as the workspace name).
Example: /sites/mysitecom/homepage/about@user-admin
NOTE: This method will probably be removed at some point. Code should never rely on the exact format of the context path since that might change in the future.
void
setName(string $newName)
Set the name of the node to $newName, keeping its position as it is.
protected void
setPath(string $path, bool $checkForExistence = true)
Sets the absolute path of this node.
This method is only for internal use by the content repository or node methods. Changing the path of a node manually may lead to unexpected behavior.
To achieve a correct behavior when changing the path (moving the node) in a workspace, a shadow node data that will hide the node data in the base workspace will be created. Thus queries do not need to worry about moved nodes. Through a movedTo reference the shadow node data will be removed when publishing the moved node.
protected bool
isNodePathAvailable(string $path)
Checks if the given node path is available for this node, so either no node with this path exists or an existing node has the same identifier.
protected array
setPathInternal(string $destinationPath, bool $recursiveCall)
Moves a node and sub nodes to the new path.
ONLY CALLED FOR Non-Aggregate Nodes, (= non-Document Nodes) -> CONTENT Nodes.
For Document Nodes, {\Neos\ContentRepository\Domain\Model\setPathInternalForAggregate} is called (in {\Neos\ContentRepository\Domain\Model\setPath}
protected array
setPathInternalForAggregate(string $destinationPath, bool $recursiveCall)
Moves a node and sub nodes to the new path given with special logic for aggregate node types.
protected array|null
moveNodeData(NodeData $nodeData, string $originalPath, string $destinationPath, bool $recursiveCall)
Moves a NodeData object that is either a variant or child node to the given destination path.
protected NodeInterface|null
createNodeForVariant(NodeData $nodeData)
Create a node for the given NodeData, given that it is a variant of the current node
protected array|null
moveVariantOrChild(string $aggregateOriginalPath, string $aggregateDestinationPath, NodeInterface $nodeToMove = null)
Moves the given variant or child node to the destination defined by the given path which is the new path for the originally moved (parent|variant) node
protected void
moveNodeToDestinationPath(NodeInterface $node, string $destinationPath)
Moves the given node to the destination path by modifying the underlaying NodeData object.
NodeInterface[]
getOtherNodeVariants()
Get other variants of this node (with different dimension values)
A variant of a node can have different dimension values and path (for non-aggregate nodes). The resulting node instances might belong to a different context.
DateTimeInterface
getCreationDateTime()
No description
DateTimeInterface
getLastModificationDateTime()
No description
void
setLastPublicationDateTime(DateTimeInterface $lastModificationDateTime)
No description
DateTimeInterface|null
getLastPublicationDateTime()
No description
string
getPath()
deprecated
deprecated
Returns the path of this node
int
getDepth()
deprecated
deprecated
Returns the level at which this node is located.
Counting starts with 0 for "/", 1 for "/foo", 2 for "/foo/bar" etc.
string
getName()
deprecated
deprecated
Returns the name of this node
string
getLabel()
Returns the node label as generated by the configured node label generator
void
setWorkspace(Workspace $workspace)
Sets the workspace of this node.
This method is only for internal use by the content repository. Changing the workspace of a node manually may lead to unexpected behavior.
Workspace
getWorkspace()
Returns the workspace this node is contained in
string
getIdentifier()
deprecated
deprecated
Returns the identifier of this node
void
setIndex(int $index)
Sets the index of this node
NOTE: This method is meant for internal use and must only be used by other nodes.
int
getIndex()
Returns the index of this node which determines the order among siblings with the same parent node.
NodeInterface
getParent()
deprecated
deprecated
null
for the root nodeReturns the parent node of this node
string
getParentPath()
deprecated
deprecated
Returns the parent node path
bool
isRoot()
Whether or not the node is the root node (i.e. has no parent node)
void
moveBefore(NodeInterface $referenceNode, string $newName = null)
Moves this node before the given node
void
moveAfter(NodeInterface $referenceNode, string $newName = null)
Moves this node after the given node
void
moveInto(NodeInterface $referenceNode, string $newName = null)
Moves this node into the given node
NodeInterface
copyBefore(NodeInterface $referenceNode, string $nodeName)
Copies this node before the given node
NodeInterface
copyAfter(NodeInterface $referenceNode, string $nodeName)
Copies this node after the given node
NodeInterface
copyInto(NodeInterface $referenceNode, string $nodeName)
Copies this node into the given node
protected NodeInterface
copyIntoInternal(NodeInterface $referenceNode, string $nodeName, bool $detachedCopy)
Internal method to do the actual copying.
For behavior of the $detachedCopy parameter, see method Node::createRecursiveCopy().
void
setProperty(string $propertyName, mixed $value)
Sets the specified property.
If the node has a content object attached, the property will be set there if it is settable.
bool
hasProperty(string $propertyName)
If this node has a property with the given name.
If the node has a content object attached, the property will be checked there.
mixed
getProperty(string $propertyName, bool $returnNodesAsIdentifiers = false)
Returns the specified property.
If the node has a content object attached, the property will be fetched there if it is gettable.
protected array
resolvePropertyReferences(array $value = [])
Maps the property value (an array of node identifiers) to the Node objects if needed.
void
removeProperty(string $propertyName)
Removes the specified property.
If the node has a content object attached, the property will not be removed on that object if it exists.
PropertyCollectionInterface
getProperties(bool $returnNodesAsIdentifiers = false)
Returns all properties of this node.
If the node has a content object attached, the properties will be fetched there.
string[]
getPropertyNames()
Returns the names of all properties of this node.
void
setContentObject(object $contentObject)
deprecated
deprecated
Sets a content object for this node.
object
getContentObject()
deprecated
deprecated
Returns the content object of this node (if any).
void
unsetContentObject()
deprecated
deprecated
Unsets the content object of this node.
void
setNodeType(NodeType $nodeType)
Sets the node type of this node.
NodeType
getNodeType()
Returns the node type of this node.
NodeInterface
createNode(string $name, NodeType $nodeType = null, string $identifier = null)
Creates, adds and returns a child node of this node. Also sets default properties and creates default subnodes.
NodeInterface
createSingleNode(string $name, NodeType $nodeType = null, string $identifier = null)
Creates, adds and returns a child node of this node, without setting default properties or creating subnodes. Only used internally.
For internal use only! TODO: New SiteImportService uses createNode() and DQL. When we drop the LegagcySiteImportService we can change this to protected.
protected bool
willChildNodeBeAutoCreated(string $name)
Checks if the given Node $name is configured as auto-created childNode in the NodeType configuration.
NodeInterface
createNodeFromTemplate(NodeTemplate $nodeTemplate, string $nodeName = null)
Creates and persists a node from the given $nodeTemplate as child node
NodeInterface
getNode(string $path)
deprecated
deprecated
Returns a node specified by the given relative path.
NodeInterface
getPrimaryChildNode()
deprecated
deprecated
Returns the primary child node of this node.
Which node acts as a primary child node will in the future depend on the node type. For now it is just the first child node.
NodeInterface[]
getChildNodes(string $nodeTypeFilter = null, int $limit = null, int $offset = null)
deprecated
deprecated
Returns all direct child nodes of this node.
If a node type is specified, only nodes of that type are returned.
int
getNumberOfChildNodes(string $nodeTypeFilter = null)
Returns the number of child nodes a similar getChildNodes() call would return.
bool
hasChildNodes(string $nodeTypeFilter = null)
deprecated
deprecated
Checks if this node has any child nodes.
void
remove()
Removes this node and all its child nodes. This is an alias for setRemoved(true)
void
setRemoved(bool $removed)
Enables using the remove method when only setters are available
bool
isRemoved()
If this node is a removed node.
void
setHidden(bool $hidden)
Sets the "hidden" flag for this node.
bool
isHidden()
Returns the current state of the hidden flag
void
setHiddenBeforeDateTime(DateTimeInterface $dateTime = null)
Sets the date and time when this node becomes potentially visible.
DateTimeInterface|null
getHiddenBeforeDateTime()
Returns the date and time before which this node will be automatically hidden.
void
setHiddenAfterDateTime(DateTimeInterface $dateTime = null)
Sets the date and time when this node should be automatically hidden
DateTimeInterface|null
getHiddenAfterDateTime()
Returns the date and time after which this node will be automatically hidden.
void
setHiddenInIndex(bool $hidden)
Sets if this node should be hidden in indexes, such as a site navigation.
bool
isHiddenInIndex()
If this node should be hidden in indexes
void
setAccessRoles(array $accessRoles)
deprecated
deprecated
Sets the roles which are required to access this node
array
getAccessRoles()
deprecated
deprecated
Returns the names of defined access roles
bool
hasAccessRestrictions()
deprecated
deprecated
Tells if a node, in general, has access restrictions, independent of the current security context.
bool
isVisible()
Tells if this node is "visible".
For this the "hidden" flag and the "hiddenBeforeDateTime" and "hiddenAfterDateTime" dates are taken into account.
bool
isAccessible()
deprecated
deprecated
Tells if this node may be accessed according to the current security context.
Context
getContext()
internal | This method is not meant to be called in userland code |
Returns the context this node operates in.
protected void
materializeNodeDataAsNeeded()
Materialize the node data either shallow or with child nodes depending on how we materialize (workspace or dimensions).
A workspace materialize doesn't necessarily need the child nodes materialized as well unless we do structural changes in which case "materializeNodeData" should be used directly. For dimensional materialization we always want child nodes though.
protected void
materializeNodeData()
Materializes the original node data (of a different workspace) into the current workspace. And unlike the shallow counterpart does that for all auto-created child nodes as well.
protected void
shallowMaterializeNodeData()
Materializes the original node data (of a different workspace) into the current workspace.
protected NodeInterface
createRecursiveCopy(NodeInterface $referenceNode, string $nodeName, bool $detachedCopy)
Create a recursive copy of this node below $referenceNode with $nodeName.
$detachedCopy only has an influence if we are copying from one dimension to the other, possibly creating a new node variant:
- If $detachedCopy is true, the whole (recursive) copy is done without connecting original and copied node, so NOT CREATING a new node variant.
- If $detachedCopy is false, and the node does not yet have a variant in the target dimension, we are CREATING a new node variant.
As a caller of this method, $detachedCopy should be true if $this->getNodeType()->isAggregate() is true, and false otherwise.
protected bool
isNodeDataMatchingContext()
The NodeData matches the context if the workspace matches exactly.
Needs to be adjusted for further context dimensions.
protected bool
workspaceIsMatchingContext()
No description
void
similarize(NodeInterface $sourceNode, bool $isCopy = false)
For internal use in createRecursiveCopy.
NodeData
getNodeData()
internal | This is not meant to be used in userland code |
No description
string
getCacheEntryIdentifier()
Returns a string which distinctly identifies this object and thus can be used as an identifier for cache entries related to this object.
array
getDimensions()
Return the assigned content dimensions of the node.
NodeInterface
createVariantForContext(Context $context)
Given a context a new node is returned that is like this node, but lives in the new context.
bool
dimensionsAreMatchingTargetDimensionValues()
Internal method
The dimension value of this node has to match the current target dimension value (must be higher in priority or equal)
void
setNodeData(NodeData $nodeData)
internal | This method is not meant to be called from userland |
Set the associated NodeData in regards to the Context.
NOTE: This is internal only and should not be used outside of the ContentRepository.
bool
isNodeTypeAllowedAsChildNode(NodeType $nodeType)
Checks if the given $nodeType would be allowed as a child node of this node according to the configured constraints.
bool
isAutoCreated()
deprecated
deprecated
Determine if this node is configured as auto-created childNode of the parent node. If that is the case, it should not be deleted.
bool
isTethered()
Whether or not this node is tethered to its parent, fka auto created child node
void
setNodeDataIsMatchingContext(bool $status = null)
Set the status of the associated NodeData in regards to the Context.
NOTE: This is internal only and should not be used outside of the ContentRepository.
ContentStreamIdentifier
getContentStreamIdentifier()
No description
NodeAggregateIdentifier
getNodeAggregateIdentifier()
No description
NodeTypeName
getNodeTypeName()
No description
NodeName|null
getNodeName()
No description
DimensionSpacePoint
getDimensionSpacePoint()
No description
OriginDimensionSpacePoint
getOriginDimensionSpacePoint()
No description
TraversableNodeInterface
findParentNode()
No description
NodePath
findNodePath()
Retrieves and returns the node's path to its root node.
TraversableNodeInterface
findNamedChildNode(NodeName $nodeName)
No description
TraversableNodes
findChildNodes(NodeTypeConstraints $nodeTypeConstraints = null, int $limit = null, int $offset = null)
Returns all direct child nodes of this node.
If a node type is specified, only nodes of that type are returned.
int
countChildNodes(NodeTypeConstraints $nodeTypeConstraints = null)
Returns the number of direct child nodes of this node from its subgraph.
TraversableNodes
findReferencedNodes()
Retrieves and returns all nodes referenced by this node from its subgraph.
TraversableNodes
findNamedReferencedNodes(PropertyName $edgeName)
Retrieves and returns nodes referenced by this node by name from its subgraph.
TraversableNodes
findReferencingNodes()
Retrieves and returns nodes referencing this node from its subgraph.
TraversableNodes
findNamedReferencingNodes(PropertyName $edgeName)
Retrieves and returns nodes referencing this node by name from its subgraph.
protected void
emitBeforeNodeMove(NodeInterface $movedNode, NodeInterface $referenceNode, int $movePosition)
No description
protected void
emitAfterNodeMove(NodeInterface $movedNode, NodeInterface $referenceNode, int $movePosition)
No description
protected void
emitBeforeNodeCopy(NodeInterface $sourceNode, NodeInterface $targetParentNode)
No description
protected void
emitAfterNodeCopy(NodeInterface $copiedNode, NodeInterface $targetParentNode)
No description
protected
emitNodePathChanged(NodeInterface $node, string $oldPath, string $newPath, bool $recursion)
Signals that the node path has been changed.
protected void
emitBeforeNodeCreate(NodeInterface $node, string $name, string $nodeType, string $identifier)
Signals that a node will be created.
protected void
emitAfterNodeCreate(NodeInterface $node)
Signals that a node was created.
protected void
emitNodeAdded(NodeInterface $node)
Signals that a node was added.
protected void
emitNodeUpdated(NodeInterface $node)
Signals that a node was updated.
protected void
emitNodeRemoved(NodeInterface $node)
Signals that a node was removed.
protected void
emitBeforeNodePropertyChange(NodeInterface $node, string $propertyName, mixed $oldValue, mixed $newValue)
Signals that the property of a node will be changed.
protected void
emitNodePropertyChanged(NodeInterface $node, string $propertyName, mixed $oldValue, mixed $newValue)
Signals that the property of a node was changed.
string
__toString()
For debugging purposes, the node can be converted to a string.
bool
equals(TraversableNodeInterface $other)
Compare whether two traversable nodes are equal