PHP Class Neos\ContentRepository\Domain\Model\NodeData

NOTE: This is internal only and should not be used or extended by userland code.
Inheritance: extends AbstractNodeData
ファイルを表示 Open project: neos/neos-development-collection Class Usage Examples

Protected Properties

Property Type Description
$contentObjectProxy ContentObjectProxy Optional proxy for a content object which acts as an alternative property container
$depth integer Level number within the global node tree
$dimensionValues array
$dimensions Doctrine\Common\Collections\Collection<\Neos\ContentRepository\Domain\Model\NodeDimension>
$dimensionsHash string MD5 hash of the content dimensions The hash is generated in buildDimensionValues().
$hiddenAfterDateTime DateTime
$hiddenBeforeDateTime DateTime
$identifier string Identifier of this node which is unique within its workspace
$index integer Index within the nodes with the same parent
$lastModificationDateTime DateTime
$lastPublicationDateTime DateTime
$movedTo NodeData If a node data is moved a "shadow" node data is inserted that references the new node data
$name string Node name, derived from its node path
$nodeService Neos\ContentRepository\Domain\Service\NodeServiceInterface
$parentPath string Absolute path of the parent path
$parentPathHash string The hash is generated in calculateParentPathHash().
$path string Absolute path of this node
$pathHash string The hash is generated in calculatePathHash().
$removed boolean If this is a removed node. This flag can and is only used in workspaces which do have a base workspace. In a bottom level workspace nodes are really removed, in other workspaces, removal is realized by this flag.
$securityContext Neos\Flow\Security\Context
$version integer Auto-incrementing version of this node data, used for optimistic locking
$workspace Workspace Workspace this node is contained in

Public Methods

Method Description
__clone ( ) : void Create a fresh collection instance and clone dimensions
__construct ( string $path, Workspace $workspace, string $identifier = null, array $dimensions = null ) Constructs this node data container
createNodeData ( string $name, NodeType $nodeType = null, string $identifier = null, Workspace $workspace = null, array $dimensions = null ) : NodeData Creates, adds and returns a child node of this node. Also sets default properties and creates default subnodes.
createNodeDataFromTemplate ( NodeTemplate $nodeTemplate, string $nodeName = null, Workspace $workspace = null, array $dimensions = null ) : NodeData Creates and persists a node from the given $nodeTemplate as child node
createShadow ( string $path ) : NodeData Create a shadow NodeData at the given path with the same workspace and dimensions as this
createSingleNodeData ( string $name, NodeType $nodeType = null, string $identifier = null, Workspace $workspace = null, array $dimensions = null ) : NodeData Creates, adds and returns a child node of this node, without setting default properties or creating subnodes.
getContextPath ( ) : string Returns the absolute path of this node with additional context information (such as the workspace name).
getDepth ( ) : integer Returns the level at which this node is located.
getDimensionValues ( ) : array Returns the dimensions and their values.
getDimensions ( ) : array Internal use, do not retrieve collection directly
getDimensionsHash ( ) : string Get a unique string for all dimension values
getIdentifier ( ) : string Returns the identifier of this node.
getIndex ( ) : integer Returns the index of this node which determines the order among siblings with the same parent node.
getMovedTo ( ) : NodeData
getName ( ) : string Returns the name of this node
getNumberOfChildNodes ( string $nodeTypeFilter = null, Workspace $workspace, array $dimensions ) : integer Returns the number of child nodes a similar getChildNodes() call would return.
getParent ( ) : NodeData Returns the parent node of this node
getParentPath ( ) : string Returns the parent node path
getPath ( ) : string Returns the path of this node
getWorkspace ( ) : Workspace Returns the workspace this node is contained in
hasAccessRestrictions ( ) : boolean Tells if a node, in general, has access restrictions, independent of the current security context.
isAccessible ( ) : boolean Tells if this node may be accessed according to the current security context.
isInternal ( ) : boolean Check if this NodeData object is a purely internal technical object (like a shadow node).
isRemoved ( ) : boolean If this node is a removed node.
isVisible ( ) : boolean Tells if this node is "visible".
matchesWorkspaceAndDimensions ( Workspace $workspace, array $dimensions = null ) : boolean Checks if this instance matches the given workspace and dimensions.
move ( string $path, Workspace $workspace ) : NodeData Move this NodeData to the given path and workspace.
remove ( ) : void Removes this node and all its child nodes. This is an alias for setRemoved(TRUE)
setDimensions ( array $dimensionsToBeSet ) : void Internal use, do not manipulate collection directly
setIdentifier ( string $identifier ) : void Change the identifier of this node data
setIndex ( integer $index ) : void Sets the index of this node
setMovedTo ( NodeData $nodeData = null ) : void
setPath ( string $path, boolean $recursive = true ) : void Sets the absolute path of this node
setRemoved ( boolean $removed ) : void Enables using the remove method when only setters are available
setWorkspace ( Workspace $workspace = null ) : void Sets the workspace of this node.
similarize ( AbstractNodeData $sourceNode, boolean $isCopy = false ) : void Make the node "similar" to the given source node. That means, - all properties - index - node type - content object will be set to the same values as in the source node.

Protected Methods

Method Description
addOrUpdate ( NodeData $nodeData = null ) Adds this node to the Node Repository or updates it if it has been added earlier
buildDimensionValues ( ) : void Build a cached array of dimension values and a hash to search for it.
calculateParentPathHash ( ) : void Calculates the hash corresponding to the dimensions and their values for this instance.
calculatePathHash ( ) : void Calculates the hash corresponding to the path of this instance.
emitNodePathChanged ( NodeData $nodeData ) : void Signals that a node has changed its path.
findExistingDimensionMatching ( NodeDimension $dimensionToBeSet ) : NodeDimension | null Internal method used in setDimensions to reuse dimension objects with the same name/value pair.
getChildNodeData ( ) : array<\Neos\ContentRepository\Domain\Model\NodeData> Returns all direct child node data of this node data without reducing the result (multiple variants can be returned)
getExistingShadowNodeData ( string $path, Workspace $workspace, array $dimensionValues ) : NodeData | null Find an existing shadow node data on the given path for the current node data of the node (used by setPath)
materializeToWorkspace ( Workspace $workspace ) : NodeData Materializes the original node data (of a different workspace) into the current workspace, excluding content dimensions
setAsShadowOf ( NodeData $nodeData = null ) : void This becomes a shdow of the given NodeData object.
updateContentObject ( object $contentObject ) : void Updates the attached content object

Method Details

__clone() public method

Create a fresh collection instance and clone dimensions
public __clone ( ) : void
return void

__construct() public method

Creating new nodes by instantiating NodeData is not part of the public API! The content repository needs to properly integrate new nodes into the node tree and therefore you must use createNode() or createNodeFromTemplate() in a Node object which will internally create a NodeData object.
public __construct ( string $path, Workspace $workspace, string $identifier = null, array $dimensions = null )
$path string Absolute path of this node
$workspace Workspace The workspace this node will be contained in
$identifier string The node identifier (not the persistence object identifier!). Specifying this only makes sense while creating corresponding nodes
$dimensions array An array of dimension name to dimension values

addOrUpdate() protected method

Adds this node to the Node Repository or updates it if it has been added earlier
protected addOrUpdate ( NodeData $nodeData = null )
$nodeData NodeData Other NodeData object to addOrUpdate

buildDimensionValues() protected method

Build a cached array of dimension values and a hash to search for it.
protected buildDimensionValues ( ) : void
return void

calculateParentPathHash() protected method

Calculates the hash corresponding to the dimensions and their values for this instance.
protected calculateParentPathHash ( ) : void
return void

calculatePathHash() protected method

Calculates the hash corresponding to the path of this instance.
protected calculatePathHash ( ) : void
return void

createNodeData() public method

Creates, adds and returns a child node of this node. Also sets default properties and creates default subnodes.
public createNodeData ( string $name, NodeType $nodeType = null, string $identifier = null, Workspace $workspace = null, array $dimensions = null ) : NodeData
$name string Name of the new node
$nodeType NodeType Node type of the new node (optional)
$identifier string The identifier of the node, unique within the workspace, optional(!)
$workspace Workspace
$dimensions array
return NodeData

createNodeDataFromTemplate() public method

Creates and persists a node from the given $nodeTemplate as child node
public createNodeDataFromTemplate ( NodeTemplate $nodeTemplate, string $nodeName = null, Workspace $workspace = null, array $dimensions = null ) : NodeData
$nodeTemplate NodeTemplate
$nodeName string name of the new node. If not specified the name of the nodeTemplate will be used.
$workspace Workspace
$dimensions array
return NodeData the freshly generated node

createShadow() public method

Note: The constructor will already add the new object to the repository Internal method, do not use outside of the content repository.
public createShadow ( string $path ) : NodeData
$path string The (original) path for the node data
return NodeData

createSingleNodeData() public method

Creates, adds and returns a child node of this node, without setting default properties or creating subnodes.
public createSingleNodeData ( string $name, NodeType $nodeType = null, string $identifier = null, Workspace $workspace = null, array $dimensions = null ) : NodeData
$name string Name of the new node
$nodeType NodeType Node type of the new node (optional)
$identifier string The identifier of the node, unique within the workspace, optional(!)
$workspace Workspace
$dimensions array An array of dimension name to dimension values
return NodeData

emitNodePathChanged() protected method

Signals that a node has changed its path.
protected emitNodePathChanged ( NodeData $nodeData ) : void
$nodeData NodeData the node data instance that has been changed
return void

findExistingDimensionMatching() protected method

Internal method used in setDimensions to reuse dimension objects with the same name/value pair.
See also: setDimensions
protected findExistingDimensionMatching ( NodeDimension $dimensionToBeSet ) : NodeDimension | null
$dimensionToBeSet NodeDimension
return NodeDimension | null

getChildNodeData() protected method

Returns all direct child node data of this node data without reducing the result (multiple variants can be returned)
protected getChildNodeData ( ) : array<\Neos\ContentRepository\Domain\Model\NodeData>
return array<\Neos\ContentRepository\Domain\Model\NodeData>

getContextPath() public method

Example: /sites/mysitecom/homepage/about@user-admin
public getContextPath ( ) : string
return string Node path with context information

getDepth() public method

Counting starts with 0 for "/", 1 for "/foo", 2 for "/foo/bar" etc.
public getDepth ( ) : integer
return integer

getDimensionValues() public method

Returns the dimensions and their values.
public getDimensionValues ( ) : array
return array

getDimensions() public method

Internal use, do not retrieve collection directly
public getDimensions ( ) : array
return array

getDimensionsHash() public method

Internal method
public getDimensionsHash ( ) : string
return string

getExistingShadowNodeData() protected method

Find an existing shadow node data on the given path for the current node data of the node (used by setPath)
protected getExistingShadowNodeData ( string $path, Workspace $workspace, array $dimensionValues ) : NodeData | null
$path string The (new) path of the node data
$workspace Workspace
$dimensionValues array
return NodeData | null

getIdentifier() public method

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
return string the node's UUID

getIndex() public method

Returns the index of this node which determines the order among siblings with the same parent node.
public getIndex ( ) : integer
return integer

getMovedTo() public method

public getMovedTo ( ) : NodeData
return NodeData

getName() public method

Returns the name of this node
public getName ( ) : string
return string

getNumberOfChildNodes() public method

Returns the number of child nodes a similar getChildNodes() call would return.
public getNumberOfChildNodes ( string $nodeTypeFilter = null, Workspace $workspace, array $dimensions ) : integer
$nodeTypeFilter string If specified, only nodes with that node type are considered
$workspace Workspace
$dimensions array
return integer The number of child nodes

getParent() public method

Returns the parent node of this node
public getParent ( ) : NodeData
return NodeData The parent node or NULL if this is the root node

getParentPath() public method

Returns the parent node path
public getParentPath ( ) : string
return string Absolute node path of the parent node

getPath() public method

Example: /sites/mysitecom/homepage/about
public getPath ( ) : string
return string The absolute node path

getWorkspace() public method

Returns the workspace this node is contained in
public getWorkspace ( ) : Workspace
return Workspace

hasAccessRestrictions() public method

Tells if a node, in general, has access restrictions, independent of the current security context.
public hasAccessRestrictions ( ) : boolean
return boolean

isAccessible() public method

Tells if this node may be accessed according to the current security context.
public isAccessible ( ) : boolean
return boolean

isInternal() public method

An internal NodeData should never produce a Node object.
public isInternal ( ) : boolean
return boolean

isRemoved() public method

If this node is a removed node.
public isRemoved ( ) : boolean
return boolean

isVisible() public method

For this the "hidden" flag and the "hiddenBeforeDateTime" and "hiddenAfterDateTime" dates are taken into account. The fact that a node is "visible" does not imply that it can / may be shown to the user. Further modifiers such as isAccessible() need to be evaluated.
public isVisible ( ) : boolean
return boolean

matchesWorkspaceAndDimensions() public method

Checks if this instance matches the given workspace and dimensions.
public matchesWorkspaceAndDimensions ( Workspace $workspace, array $dimensions = null ) : boolean
$workspace Workspace
$dimensions array
return boolean

materializeToWorkspace() protected method

This is only used in setPath for now
protected materializeToWorkspace ( Workspace $workspace ) : NodeData
$workspace Workspace
return NodeData

move() public method

Basically 4 scenarios have to be covered here, depending on: - Does the NodeData have to be materialized (adapted to the workspace or target dimension)? - Does a shadow node exist on the target path? Because unique key constraints and Doctrine ORM don't support arbitrary removal and update combinations, existing NodeData instances are re-used and the metadata and content is swapped around.
public move ( string $path, Workspace $workspace ) : NodeData
$path string
$workspace Workspace
return NodeData If a shadow node was created this is the new NodeData object after the move.

remove() public method

Removes this node and all its child nodes. This is an alias for setRemoved(TRUE)
public remove ( ) : void
return void

setAsShadowOf() protected method

If NULL or no argument is given then movedTo is nulled and removed is set to FALSE effectively turning this into a normal NodeData.
protected setAsShadowOf ( NodeData $nodeData = null ) : void
$nodeData NodeData
return void

setDimensions() public method

Internal use, do not manipulate collection directly
public setDimensions ( array $dimensionsToBeSet ) : void
$dimensionsToBeSet array
return void

setIdentifier() public method

NOTE: This is only used for some very rare cases (to replace existing instances when moving).
public setIdentifier ( string $identifier ) : void
$identifier string
return void

setIndex() public method

Sets the index of this node
public setIndex ( integer $index ) : void
$index integer The new index
return void

setMovedTo() public method

public setMovedTo ( NodeData $nodeData = null ) : void
$nodeData NodeData
return void

setPath() public method

Sets the absolute path of this node
public setPath ( string $path, boolean $recursive = true ) : void
$path string
$recursive boolean
return void

setRemoved() public method

Enables using the remove method when only setters are available
public setRemoved ( boolean $removed ) : void
$removed boolean If TRUE, this node and it's child nodes will be removed. This can handle FALSE as well.
return void

setWorkspace() public method

Sets the workspace of this node.
public setWorkspace ( Workspace $workspace = null ) : void
$workspace Workspace
return void

similarize() public method

Make the node "similar" to the given source node. That means, - all properties - index - node type - content object will be set to the same values as in the source node.
public similarize ( AbstractNodeData $sourceNode, boolean $isCopy = false ) : void
$sourceNode AbstractNodeData
$isCopy boolean
return void

updateContentObject() protected method

Updates the attached content object
protected updateContentObject ( object $contentObject ) : void
$contentObject object
return void

Property Details

$contentObjectProxy protected_oe property

Optional proxy for a content object which acts as an alternative property container
protected ContentObjectProxy,Neos\ContentRepository\Domain\Model $contentObjectProxy
return ContentObjectProxy

$depth protected_oe property

Level number within the global node tree
protected int $depth
return integer

$dimensionValues protected_oe property

protected array $dimensionValues
return array

$dimensions protected_oe property

protected NodeDimension>,Doctrine\Common\Collections\Collection<\Neos\ContentRepository\Domain\Model $dimensions
return Doctrine\Common\Collections\Collection<\Neos\ContentRepository\Domain\Model\NodeDimension>

$dimensionsHash protected_oe property

MD5 hash of the content dimensions The hash is generated in buildDimensionValues().
protected string $dimensionsHash
return string

$hiddenAfterDateTime protected_oe property

protected DateTime $hiddenAfterDateTime
return DateTime

$hiddenBeforeDateTime protected_oe property

protected DateTime $hiddenBeforeDateTime
return DateTime

$identifier protected_oe property

Identifier of this node which is unique within its workspace
protected string $identifier
return string

$index protected_oe property

Index within the nodes with the same parent
protected int $index
return integer

$lastModificationDateTime protected_oe property

protected DateTime $lastModificationDateTime
return DateTime

$lastPublicationDateTime protected_oe property

protected DateTime $lastPublicationDateTime
return DateTime

$movedTo protected_oe property

If a node data is moved a "shadow" node data is inserted that references the new node data
protected NodeData,Neos\ContentRepository\Domain\Model $movedTo
return NodeData

$name protected_oe property

Node name, derived from its node path
protected string $name
return string

$nodeService protected_oe property

protected NodeServiceInterface,Neos\ContentRepository\Domain\Service $nodeService
return Neos\ContentRepository\Domain\Service\NodeServiceInterface

$parentPath protected_oe property

Absolute path of the parent path
protected string $parentPath
return string

$parentPathHash protected_oe property

The hash is generated in calculateParentPathHash().
protected string $parentPathHash
return string

$path protected_oe property

Absolute path of this node
protected string $path
return string

$pathHash protected_oe property

The hash is generated in calculatePathHash().
protected string $pathHash
return string

$removed protected_oe property

If this is a removed node. This flag can and is only used in workspaces which do have a base workspace. In a bottom level workspace nodes are really removed, in other workspaces, removal is realized by this flag.
protected bool $removed
return boolean

$securityContext protected_oe property

protected Context,Neos\Flow\Security $securityContext
return Neos\Flow\Security\Context

$version protected_oe property

Auto-incrementing version of this node data, used for optimistic locking
protected int $version
return integer

$workspace protected_oe property

Workspace this node is contained in
protected Workspace,Neos\ContentRepository\Domain\Model $workspace
return Workspace