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

__construct(NodeData $nodeData, Context $context)

No description

string
getContextPath()

Returns the absolute path of this node with additional context information (such as the workspace name).

void
setName(string $newName)

Set the name of the node to $newName, keeping its position as it is.

void
setPath(string $path, bool $checkForExistence = true)

Sets the absolute path of this node.

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.

array
setPathInternal(string $destinationPath, bool $recursiveCall)

Moves a node and sub nodes to the new path.

array
setPathInternalForAggregate(string $destinationPath, bool $recursiveCall)

Moves a node and sub nodes to the new path given with special logic for aggregate node types.

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.

NodeInterface|null
createNodeForVariant(NodeData $nodeData)

Create a node for the given NodeData, given that it is a variant of the current node

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

void
moveNodeToDestinationPath(NodeInterface $node, string $destinationPath)

Moves the given node to the destination path by modifying the underlaying NodeData object.

getOtherNodeVariants()

Get other variants of this node (with different dimension values)

void
setLastPublicationDateTime(DateTimeInterface $lastModificationDateTime)

No description

DateTimeInterface|null
getLastPublicationDateTime()

No description

string
getPath() deprecated

Returns the path of this node

int
getDepth() deprecated

Returns the level at which this node is located.

string
getName() 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.

getWorkspace()

Returns the workspace this node is contained in

string
getIdentifier() deprecated

Returns the identifier of this node

void
setIndex(int $index)

Sets the index of this node

int
getIndex()

Returns the index of this node which determines the order among siblings with the same parent node.

getParent() deprecated

Returns the parent node of this node

string
getParentPath() 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

copyBefore(NodeInterface $referenceNode, string $nodeName)

Copies this node before the given node

copyAfter(NodeInterface $referenceNode, string $nodeName)

Copies this node after the given node

copyInto(NodeInterface $referenceNode, string $nodeName)

Copies this node into the given node

copyIntoInternal(NodeInterface $referenceNode, string $nodeName, bool $detachedCopy)

Internal method to do the actual copying.

void
setProperty(string $propertyName, mixed $value)

Sets the specified property.

bool
hasProperty(string $propertyName)

If this node has a property with the given name.

mixed
getProperty(string $propertyName, bool $returnNodesAsIdentifiers = false)

Returns the specified property.

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.

getProperties(bool $returnNodesAsIdentifiers = false)

Returns all properties of this node.

string[]
getPropertyNames()

Returns the names of all properties of this node.

void
setContentObject(object $contentObject) deprecated

Sets a content object for this node.

object
getContentObject() deprecated

Returns the content object of this node (if any).

void
unsetContentObject() deprecated

Unsets the content object of this node.

void
setNodeType(NodeType $nodeType)

Sets the node type of this node.

getNodeType()

Returns the node type of this node.

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.

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.

bool
willChildNodeBeAutoCreated(string $name)

Checks if the given Node $name is configured as auto-created childNode in the NodeType configuration.

createNodeFromTemplate(NodeTemplate $nodeTemplate, string $nodeName = null)

Creates and persists a node from the given $nodeTemplate as child node

getNode(string $path) deprecated

Returns a node specified by the given relative path.

getPrimaryChildNode() deprecated

Returns the primary child node of this node.

getChildNodes(string $nodeTypeFilter = null, int $limit = null, int $offset = null) deprecated

Returns all direct child nodes of this node.

int
getNumberOfChildNodes(string $nodeTypeFilter = null)

Returns the number of child nodes a similar getChildNodes() call would return.

bool
hasChildNodes(string $nodeTypeFilter = null) 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.

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

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

Sets the roles which are required to access this node

array
getAccessRoles() deprecated

Returns the names of defined access roles

bool
hasAccessRestrictions() deprecated

Tells if a node, in general, has access restrictions, independent of the current security context.

bool
isVisible()

Tells if this node is "visible".

bool
isAccessible() deprecated

Tells if this node may be accessed according to the current security context.

getContext()

Returns the context this node operates in.

void
materializeNodeDataAsNeeded()

Materialize the node data either shallow or with child nodes depending on how we materialize (workspace or dimensions).

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.

void
shallowMaterializeNodeData()

Materializes the original node data (of a different workspace) into the current workspace.

createRecursiveCopy(NodeInterface $referenceNode, string $nodeName, bool $detachedCopy)

Create a recursive copy of this node below $referenceNode with $nodeName.

bool
isNodeDataMatchingContext()

The NodeData matches the context if the workspace matches exactly.

bool
workspaceIsMatchingContext()

No description

void
similarize(NodeInterface $sourceNode, bool $isCopy = false)

For internal use in createRecursiveCopy.

getNodeData()

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.

createVariantForContext(Context $context)

Given a context a new node is returned that is like this node, but lives in the new context.

void
setNodeData(NodeData $nodeData)

Set the associated NodeData in regards to the Context.

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

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.

getNodeTypeName()

No description

NodeName|null
getNodeName()

No description

DimensionSpacePoint
getDimensionSpacePoint()

No description

OriginDimensionSpacePoint
getOriginDimensionSpacePoint()

No description

findNodePath()

Retrieves and returns the node's path to its root node.

findChildNodes(NodeTypeConstraints $nodeTypeConstraints = null, int $limit = null, int $offset = null)

Returns all direct child nodes of this node.

int
countChildNodes(NodeTypeConstraints $nodeTypeConstraints = null)

Returns the number of direct child nodes of this node from its subgraph.

findReferencedNodes()

Retrieves and returns all nodes referenced by this node from its subgraph.

findNamedReferencedNodes(PropertyName $edgeName)

Retrieves and returns nodes referenced by this node by name from its subgraph.

findReferencingNodes()

Retrieves and returns nodes referencing this node from its subgraph.

findNamedReferencingNodes(PropertyName $edgeName)

Retrieves and returns nodes referencing this node by name from its subgraph.

void
emitBeforeNodeMove(NodeInterface $movedNode, NodeInterface $referenceNode, int $movePosition)

No description

void
emitAfterNodeMove(NodeInterface $movedNode, NodeInterface $referenceNode, int $movePosition)

No description

void
emitBeforeNodeCopy(NodeInterface $sourceNode, NodeInterface $targetParentNode)

No description

void
emitAfterNodeCopy(NodeInterface $copiedNode, NodeInterface $targetParentNode)

No description

emitNodePathChanged(NodeInterface $node, string $oldPath, string $newPath, bool $recursion)

Signals that the node path has been changed.

void
emitBeforeNodeCreate(NodeInterface $node, string $name, string $nodeType, string $identifier)

Signals that a node will be created.

void
emitAfterNodeCreate(NodeInterface $node)

Signals that a node was created.

void
emitNodeAdded(NodeInterface $node)

Signals that a node was added.

void
emitNodeUpdated(NodeInterface $node)

Signals that a node was updated.

void
emitNodeRemoved(NodeInterface $node)

Signals that a node was removed.

void
emitBeforeNodePropertyChange(NodeInterface $node, string $propertyName, mixed $oldValue, mixed $newValue)

Signals that the property of a node will be changed.

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

Details

__construct(NodeData $nodeData, Context $context)

No description

Parameters

NodeData $nodeData
Context $context

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.

Return Value

string

Node path with context information

void setName(string $newName)

Set the name of the node to $newName, keeping its position as it is.

Parameters

string $newName

Return Value

void

Exceptions

NodeException
InvalidArgumentException
NodeTypeNotFoundException

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.

Parameters

string $path
bool $checkForExistence

Checks for existence at target path, internally used for recursions and shadow nodes.

Return Value

void

Exceptions

NodeException
NodeTypeNotFoundException

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.

Parameters

string $path

Return Value

bool

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}

Parameters

string $destinationPath

the new node path

bool $recursiveCall

is this a recursive call

Return Value

array

NodeVariants and old and new paths

Exceptions

NodeException
NodeTypeNotFoundException

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.

Parameters

string $destinationPath

the new node path

bool $recursiveCall

is this a recursive call

Return Value

array

of arrays with NodeVariant and old and new path and if this was a recursive call

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.

Parameters

NodeData $nodeData
string $originalPath
string $destinationPath
bool $recursiveCall

Return Value

array|null

Exceptions

NodeConfigurationException

protected NodeInterface|null createNodeForVariant(NodeData $nodeData)

Create a node for the given NodeData, given that it is a variant of the current node

Parameters

NodeData $nodeData

Return Value

NodeInterface|null

Exceptions

NodeConfigurationException

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

Parameters

string $aggregateOriginalPath
string $aggregateDestinationPath
NodeInterface $nodeToMove

Return Value

array|null

NodeVariant and old and new path

protected void moveNodeToDestinationPath(NodeInterface $node, string $destinationPath)

Moves the given node to the destination path by modifying the underlaying NodeData object.

Parameters

NodeInterface $node
string $destinationPath

Return Value

void

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.

Return Value

NodeInterface[]

All node variants of this node (excluding the current node)

DateTimeInterface getCreationDateTime()

No description

Return Value

DateTimeInterface

DateTimeInterface getLastModificationDateTime()

No description

Return Value

DateTimeInterface

void setLastPublicationDateTime(DateTimeInterface $lastModificationDateTime)

No description

Parameters

DateTimeInterface $lastModificationDateTime

Return Value

void

DateTimeInterface|null getLastPublicationDateTime()

No description

Return Value

DateTimeInterface|null

Date of last publication or null if the node was not published yet

string getPath() deprecated

deprecated with version 4.3, use TraversableNodeInterface::findNodePath() instead.

Returns the path of this node

Return Value

string

The absolute node path

int getDepth() deprecated

deprecated with version 4.3 - Use TraversableNodeInterface::findNodePath()->getDepth() instead

Returns the level at which this node is located.

Counting starts with 0 for "/", 1 for "/foo", 2 for "/foo/bar" etc.

Return Value

int

string getName() deprecated

deprecated with version 4.3, use TraversableNodeInterface::getNodeName() instead.

Returns the name of this node

Return Value

string

string getLabel()

Returns the node label as generated by the configured node label generator

Return Value

string

Exceptions

NodeTypeNotFoundException

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.

Parameters

Workspace $workspace

Return Value

void

Exceptions

NodeException
NodeTypeNotFoundException

Workspace getWorkspace()

Returns the workspace this node is contained in

Return Value

Workspace

string getIdentifier() deprecated

deprecated with version 4.3, use getNodeAggregateIdentifier() instead.

Returns the identifier of this node

Return Value

string

the node's UUID

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.

Parameters

int $index

The new index

Return Value

void

Exceptions

NodeException
NodeTypeNotFoundException

int getIndex()

Returns the index of this node which determines the order among siblings with the same parent node.

Return Value

int

NodeInterface getParent() deprecated

deprecated with version 4.3, use TraversableNodeInterface::findParentNode() instead. Beware that findParentNode() is not fully equivalent to this method. It has a different root node handling: - findParentNode() throws an exception for the root node - getParent() returns null for the root node

Returns the parent node of this node

Return Value

NodeInterface

The parent node or NULL if this is the root node

string getParentPath() deprecated

deprecated with version 4.3, use TraversableNodeInterface::findParentNode()->findNodePath() instead.

Returns the parent node path

Return Value

string

Absolute node path of the parent node

bool isRoot()

Whether or not the node is the root node (i.e. has no parent node)

Return Value

bool

void moveBefore(NodeInterface $referenceNode, string $newName = null)

Moves this node before the given node

Parameters

NodeInterface $referenceNode
string $newName

Return Value

void

Exceptions

NodeConstraintException
NodeException
NodeExistsException
NodeTypeNotFoundException

void moveAfter(NodeInterface $referenceNode, string $newName = null)

Moves this node after the given node

Parameters

NodeInterface $referenceNode
string $newName

Return Value

void

Exceptions

NodeConstraintException
NodeException
NodeExistsException
NodeTypeNotFoundException

void moveInto(NodeInterface $referenceNode, string $newName = null)

Moves this node into the given node

Parameters

NodeInterface $referenceNode
string $newName

Return Value

void

Exceptions

NodeConstraintException
NodeException
NodeExistsException
NodeTypeNotFoundException

NodeInterface copyBefore(NodeInterface $referenceNode, string $nodeName)

Copies this node before the given node

Parameters

NodeInterface $referenceNode
string $nodeName

Return Value

NodeInterface

The copied node

Exceptions

NodeConstraintException
NodeException
NodeExistsException
NodeTypeNotFoundException

NodeInterface copyAfter(NodeInterface $referenceNode, string $nodeName)

Copies this node after the given node

Parameters

NodeInterface $referenceNode
string $nodeName

Return Value

NodeInterface

The copied node

Exceptions

NodeConstraintException
NodeException
NodeExistsException
NodeTypeNotFoundException

NodeInterface copyInto(NodeInterface $referenceNode, string $nodeName)

Copies this node into the given node

Parameters

NodeInterface $referenceNode
string $nodeName

Return Value

NodeInterface

The copied node

Exceptions

NodeConstraintException
NodeException
NodeExistsException
NodeTypeNotFoundException

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().

Parameters

NodeInterface $referenceNode
string $nodeName
bool $detachedCopy

Return Value

NodeInterface

Exceptions

NodeConstraintException
NodeException
NodeExistsException
NodeTypeNotFoundException

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.

Parameters

string $propertyName

Name of the property

mixed $value

Value of the property

Return Value

void

Exceptions

NodeException
NodeTypeNotFoundException
Exception
Exception

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.

Parameters

string $propertyName

Name of the property to test for

Return Value

bool

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.

Parameters

string $propertyName

Name of the property

bool $returnNodesAsIdentifiers

If enabled, references to nodes are returned as node identifiers instead of NodeInterface instances

Return Value

mixed

value of the property

Exceptions

NodeException
Exception
Exception
NodeTypeNotFoundException

protected array resolvePropertyReferences(array $value = [])

Maps the property value (an array of node identifiers) to the Node objects if needed.

Parameters

array $value

Return Value

array

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.

Parameters

string $propertyName

Name of the property

Return Value

void

Exceptions

NodeException
NodeTypeNotFoundException

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.

Parameters

bool $returnNodesAsIdentifiers

If enabled, references to nodes are returned as node identifiers instead of NodeData objects

Return Value

PropertyCollectionInterface

Property values

Exceptions

NodeException
NodeTypeNotFoundException
Exception
Exception

string[] getPropertyNames()

Returns the names of all properties of this node.

Return Value

string[]

Property names

void setContentObject(object $contentObject) deprecated

deprecated with version 4.3. Attaching entities to nodes never really worked. Instead you can reference objects as node properties via their identifier

Sets a content object for this node.

Parameters

object $contentObject

The content object

Return Value

void

Exceptions

NodeTypeNotFoundException
NodeException

object getContentObject() deprecated

deprecated with version 4.3. Attaching entities to nodes never really worked. Instead you can reference objects as node properties via their identifier

Returns the content object of this node (if any).

Return Value

object

The content object or NULL if none was set

void unsetContentObject() deprecated

deprecated with version 4.3. Attaching entities to nodes never really worked. Instead you can reference objects as node properties via their identifier

Unsets the content object of this node.

Return Value

void

Exceptions

NodeTypeNotFoundException
NodeException

void setNodeType(NodeType $nodeType)

Sets the node type of this node.

Parameters

NodeType $nodeType

Return Value

void

Exceptions

NodeException
NodeTypeNotFoundException

NodeType getNodeType()

Returns the node type of this node.

Return Value

NodeType

Exceptions

NodeTypeNotFoundException

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.

Parameters

string $name

Name of the new node

NodeType $nodeType

Node type of the new node (optional)

string $identifier

The identifier of the node, unique within the workspace, optional(!)

Return Value

NodeInterface

Exceptions

NodeConfigurationException
NodeConstraintException
NodeException
NodeExistsException
NodeTypeNotFoundException

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.

Parameters

string $name

Name of the new node

NodeType $nodeType

Node type of the new node (optional)

string $identifier

The identifier of the node, unique within the workspace, optional(!)

Return Value

NodeInterface

Exceptions

NodeConfigurationException
NodeConstraintException
NodeException
NodeExistsException
NodeTypeNotFoundException

protected bool willChildNodeBeAutoCreated(string $name)

Checks if the given Node $name is configured as auto-created childNode in the NodeType configuration.

Parameters

string $name

The node name to check.

Return Value

bool

true if the given nodeName is configured as auto-created child node.

Exceptions

NodeTypeNotFoundException

NodeInterface createNodeFromTemplate(NodeTemplate $nodeTemplate, string $nodeName = null)

Creates and persists a node from the given $nodeTemplate as child node

Parameters

NodeTemplate $nodeTemplate
string $nodeName

name of the new node. If not specified the name of the nodeTemplate will be used.

Return Value

NodeInterface

the freshly generated node

Exceptions

NodeConfigurationException

NodeInterface getNode(string $path) deprecated

deprecated with version 4.3 - use TraversableNodeInterface::findNamedChildNode() instead

Returns a node specified by the given relative path.

Parameters

string $path

Path specifying the node, relative to this node

Return Value

NodeInterface

The specified node or NULL if no such node exists

NodeInterface getPrimaryChildNode() deprecated

deprecated with version 4.3. use TraversableNodeInterface::findChildNodes() instead, the first result is considered the "primary child node"

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.

Return Value

NodeInterface

The primary child node or NULL if no such node exists

NodeInterface[] getChildNodes(string $nodeTypeFilter = null, int $limit = null, int $offset = null) deprecated

deprecated with version 4.3, use TraversableNodeInterface::findChildNodes() instead.

Returns all direct child nodes of this node.

If a node type is specified, only nodes of that type are returned.

Parameters

string $nodeTypeFilter

If specified, only nodes with that node type are considered

int $limit

An optional limit for the number of nodes to find. Added or removed nodes can still change the number nodes!

int $offset

An optional offset for the query

Return Value

NodeInterface[]

An array of nodes or an empty array if no child nodes matched

int getNumberOfChildNodes(string $nodeTypeFilter = null)

Returns the number of child nodes a similar getChildNodes() call would return.

Parameters

string $nodeTypeFilter

If specified, only nodes with that node type are considered

Return Value

int

The number of child nodes

bool hasChildNodes(string $nodeTypeFilter = null) deprecated

deprecated with version 4.3, use TraversableNodeInterface::findChildNodes() instead and count the result

Checks if this node has any child nodes.

Parameters

string $nodeTypeFilter

If specified, only nodes with that node type are considered

Return Value

bool

true if this node has child nodes, otherwise false

void remove()

Removes this node and all its child nodes. This is an alias for setRemoved(true)

Return Value

void

Exceptions

NodeTypeNotFoundException
NodeException

void setRemoved(bool $removed)

Enables using the remove method when only setters are available

Parameters

bool $removed

If true, this node and it's child nodes will be removed or set to be not removed.

Return Value

void

Exceptions

NodeException
NodeTypeNotFoundException

bool isRemoved()

If this node is a removed node.

Return Value

bool

void setHidden(bool $hidden)

Sets the "hidden" flag for this node.

Parameters

bool $hidden

If true, this Node will be hidden

Return Value

void

Exceptions

NodeTypeNotFoundException
NodeException

bool isHidden()

Returns the current state of the hidden flag

Return Value

bool

void setHiddenBeforeDateTime(DateTimeInterface $dateTime = null)

Sets the date and time when this node becomes potentially visible.

Parameters

DateTimeInterface $dateTime

Date before this node should be hidden

Return Value

void

Exceptions

NodeTypeNotFoundException
NodeException

DateTimeInterface|null getHiddenBeforeDateTime()

Returns the date and time before which this node will be automatically hidden.

Return Value

DateTimeInterface|null

Date before this node will be hidden - or null if no hidden before date is set

void setHiddenAfterDateTime(DateTimeInterface $dateTime = null)

Sets the date and time when this node should be automatically hidden

Parameters

DateTimeInterface $dateTime

Date after which this node should be hidden

Return Value

void

Exceptions

NodeTypeNotFoundException
NodeException

DateTimeInterface|null getHiddenAfterDateTime()

Returns the date and time after which this node will be automatically hidden.

Return Value

DateTimeInterface|null

Date after which this node will be hidden - or null if no hidden after date is set

void setHiddenInIndex(bool $hidden)

Sets if this node should be hidden in indexes, such as a site navigation.

Parameters

bool $hidden

true if it should be hidden, otherwise false

Return Value

void

Exceptions

NodeTypeNotFoundException
NodeException

bool isHiddenInIndex()

If this node should be hidden in indexes

Return Value

bool

void setAccessRoles(array $accessRoles) deprecated

deprecated with version 4.3. Use a Policy to restrict access to nodes

Sets the roles which are required to access this node

Parameters

array $accessRoles

Return Value

void

Exceptions

NodeTypeNotFoundException
NodeException

array getAccessRoles() deprecated

deprecated with version 4.3. Use a Policy to restrict access to nodes

Returns the names of defined access roles

Return Value

array

bool hasAccessRestrictions() deprecated

deprecated with version 4.3. Use a Policy to restrict access to nodes

Tells if a node, in general, has access restrictions, independent of the current security context.

Return Value

bool

bool isVisible()

Tells if this node is "visible".

For this the "hidden" flag and the "hiddenBeforeDateTime" and "hiddenAfterDateTime" dates are taken into account.

Return Value

bool

bool isAccessible() deprecated

deprecated with version 4.3. Use a Policy to restrict access to nodes

Tells if this node may be accessed according to the current security context.

Return Value

bool

Context getContext()

internal  This method is not meant to be called in userland code
 

Returns the context this node operates in.

Return Value

Context

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.

Return Value

void

Exceptions

NodeTypeNotFoundException
NodeException

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.

Return Value

void

Exceptions

NodeException
NodeTypeNotFoundException

See also

shallowMaterializeNodeData

protected void shallowMaterializeNodeData()

Materializes the original node data (of a different workspace) into the current workspace.

Return Value

void

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.

Parameters

NodeInterface $referenceNode
string $nodeName
bool $detachedCopy

Return Value

NodeInterface

Exceptions

NodeConstraintException
NodeException
NodeExistsException
NodeTypeNotFoundException

protected bool isNodeDataMatchingContext()

The NodeData matches the context if the workspace matches exactly.

Needs to be adjusted for further context dimensions.

Return Value

bool

protected bool workspaceIsMatchingContext()

No description

Return Value

bool

void similarize(NodeInterface $sourceNode, bool $isCopy = false)

For internal use in createRecursiveCopy.

Parameters

NodeInterface $sourceNode
bool $isCopy

Return Value

void

NodeData getNodeData()

internal  This is not meant to be used in userland code
 

No description

Return Value

NodeData

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.

Return Value

string

array getDimensions()

Return the assigned content dimensions of the node.

Return Value

array

An array of dimensions to array of dimension values

NodeInterface createVariantForContext(Context $context)

Given a context a new node is returned that is like this node, but lives in the new context.

Parameters

Context $context

Return Value

NodeInterface

Exceptions

NodeConfigurationException
NodeTypeNotFoundException

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)

Return Value

bool

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.

Parameters

NodeData $nodeData

Return Value

void

bool isNodeTypeAllowedAsChildNode(NodeType $nodeType)

Checks if the given $nodeType would be allowed as a child node of this node according to the configured constraints.

Parameters

NodeType $nodeType

Return Value

bool

true if the passed $nodeType is allowed as child node

Exceptions

NodeTypeNotFoundException

bool isAutoCreated() deprecated

deprecated with version 4.3. This information should not be required usually. Otherwise it can be determined via: if (array_key_exists((string)$node->getNodeName(), $parent->getNodeType()->getAutoCreatedChildNodes()))

Determine if this node is configured as auto-created childNode of the parent node. If that is the case, it should not be deleted.

Return Value

bool

true if this node is auto-created by the parent.

bool isTethered()

Whether or not this node is tethered to its parent, fka auto created child node

Return Value

bool

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.

Parameters

bool $status

Return Value

void

ContentStreamIdentifier getContentStreamIdentifier()

No description

NodeAggregateIdentifier getNodeAggregateIdentifier()

No description

Return Value

NodeAggregateIdentifier

Exceptions

Exception

NodeTypeName getNodeTypeName()

No description

Return Value

NodeTypeName

Exceptions

NodeTypeNotFoundException

NodeName|null getNodeName()

No description

Return Value

NodeName|null

DimensionSpacePoint getDimensionSpacePoint()

No description

Return Value

DimensionSpacePoint

Exceptions

NodeMethodIsUnsupported

OriginDimensionSpacePoint getOriginDimensionSpacePoint()

No description

Return Value

OriginDimensionSpacePoint

Exceptions

NodeMethodIsUnsupported

TraversableNodeInterface findParentNode()

No description

Return Value

TraversableNodeInterface

the parent node, never null

Exceptions

NodeException

NodePath findNodePath()

Retrieves and returns the node's path to its root node.

Return Value

NodePath

TraversableNodeInterface findNamedChildNode(NodeName $nodeName)

No description

Parameters

NodeName $nodeName

The name

Return Value

TraversableNodeInterface

Exceptions

NodeException

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.

Parameters

NodeTypeConstraints $nodeTypeConstraints

If specified, only nodes with that node type are considered

int $limit

An optional limit for the number of nodes to find. Added or removed nodes can still change the number nodes!

int $offset

An optional offset for the query

Return Value

TraversableNodes

Traversable nodes that matched the given constraints

int countChildNodes(NodeTypeConstraints $nodeTypeConstraints = null)

Returns the number of direct child nodes of this node from its subgraph.

Parameters

NodeTypeConstraints $nodeTypeConstraints

If specified, only nodes with that node type are considered

Return Value

int

TraversableNodes findReferencedNodes()

Retrieves and returns all nodes referenced by this node from its subgraph.

Return Value

TraversableNodes

Exceptions

NodeException
NodeTypeNotFoundException
Exception
Exception

TraversableNodes findNamedReferencedNodes(PropertyName $edgeName)

Retrieves and returns nodes referenced by this node by name from its subgraph.

Parameters

PropertyName $edgeName

Return Value

TraversableNodes

Exceptions

NodeException
NodeTypeNotFoundException
Exception
Exception

TraversableNodes findReferencingNodes()

Retrieves and returns nodes referencing this node from its subgraph.

Return Value

TraversableNodes

Exceptions

NodeMethodIsUnsupported

TraversableNodes findNamedReferencingNodes(PropertyName $edgeName)

Retrieves and returns nodes referencing this node by name from its subgraph.

Parameters

PropertyName $edgeName

Return Value

TraversableNodes

Exceptions

NodeMethodIsUnsupported

protected void emitBeforeNodeMove(NodeInterface $movedNode, NodeInterface $referenceNode, int $movePosition)

No description

Parameters

NodeInterface $movedNode
NodeInterface $referenceNode
int $movePosition

Return Value

void

protected void emitAfterNodeMove(NodeInterface $movedNode, NodeInterface $referenceNode, int $movePosition)

No description

Parameters

NodeInterface $movedNode
NodeInterface $referenceNode
int $movePosition

Return Value

void

protected void emitBeforeNodeCopy(NodeInterface $sourceNode, NodeInterface $targetParentNode)

No description

Parameters

NodeInterface $sourceNode
NodeInterface $targetParentNode

Return Value

void

protected void emitAfterNodeCopy(NodeInterface $copiedNode, NodeInterface $targetParentNode)

No description

Parameters

NodeInterface $copiedNode
NodeInterface $targetParentNode

Return Value

void

protected emitNodePathChanged(NodeInterface $node, string $oldPath, string $newPath, bool $recursion)

Signals that the node path has been changed.

Parameters

NodeInterface $node
string $oldPath
string $newPath
bool $recursion

true if the node path change was caused because a parent node path was changed

protected void emitBeforeNodeCreate(NodeInterface $node, string $name, string $nodeType, string $identifier)

Signals that a node will be created.

Parameters

NodeInterface $node
string $name
string $nodeType
string $identifier

Return Value

void

protected void emitAfterNodeCreate(NodeInterface $node)

Signals that a node was created.

Parameters

NodeInterface $node

Return Value

void

protected void emitNodeAdded(NodeInterface $node)

Signals that a node was added.

Parameters

NodeInterface $node

Return Value

void

protected void emitNodeUpdated(NodeInterface $node)

Signals that a node was updated.

Parameters

NodeInterface $node

Return Value

void

protected void emitNodeRemoved(NodeInterface $node)

Signals that a node was removed.

Parameters

NodeInterface $node

Return Value

void

protected void emitBeforeNodePropertyChange(NodeInterface $node, string $propertyName, mixed $oldValue, mixed $newValue)

Signals that the property of a node will be changed.

Parameters

NodeInterface $node
string $propertyName

name of the property that has been changed/added

mixed $oldValue

the property value before it was changed or NULL if the property is new

mixed $newValue

the new property value

Return Value

void

protected void emitNodePropertyChanged(NodeInterface $node, string $propertyName, mixed $oldValue, mixed $newValue)

Signals that the property of a node was changed.

Parameters

NodeInterface $node
string $propertyName

name of the property that has been changed/added

mixed $oldValue

the property value before it was changed or NULL if the property is new

mixed $newValue

the new property value

Return Value

void

string __toString()

For debugging purposes, the node can be converted to a string.

Return Value

string

Exceptions

NodeTypeNotFoundException

bool equals(TraversableNodeInterface $other)

Compare whether two traversable nodes are equal

Parameters

TraversableNodeInterface $other

Return Value

bool