final class Node (View source)

Main read model of the {ContentSubgraphInterface}.

Immutable, Read Only. In case you want to modify it, you need to create Commands and send them to ContentRepository::handle.

Identity of a Node

The node's "Read Model" identity is summarized here {\Neos\ContentRepository\Core\SharedModel\Node\NodeAddress}, consisting of:

  • {\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId}
  • {\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName}
  • {\Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint}
  • {\Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId}

The node address can be constructed via {\Neos\ContentRepository\Core\SharedModel\Node\NodeAddress::fromNode()} and serialized.

Traversing the graph

The node does not have structure information, i.e. no infos about its children. To f.e. fetch children, you need to fetch the subgraph and use findChildNodes on the subgraph:

$subgraph = $contentRepository->getContentGraph($node->workspaceName)->getSubgraph(
    $node->dimensionSpacePoint,
    $node->visibilityConstraints
);
$childNodes = $subgraph->findChildNodes($node->aggregateId, FindChildNodesFilter::create());

A note about the {\Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint} and the {\Neos\ContentRepository\Core\DimensionSpace\OriginDimensionSpacePoint}

The {\Neos\ContentRepository\Core\Projection\ContentGraph\Node::dimensionSpacePoint} is the DimensionSpacePoint this node has been accessed in, and NOT the DimensionSpacePoint where the node is "at home". The DimensionSpacePoint where the node is (at home) is called the ORIGIN DimensionSpacePoint, and this can be accessed using {\Neos\ContentRepository\Core\Projection\ContentGraph\Node::originDimensionSpacePoint}. If in doubt, you'll usually need the DimensionSpacePoint instead of the OriginDimensionSpacePoint; you'll only need the OriginDimensionSpacePoint when constructing commands on the write side.

Methods

static Node
create(ContentRepositoryId $contentRepositoryId, WorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $aggregateId, OriginDimensionSpacePoint $originDimensionSpacePoint, NodeAggregateClassification $classification, NodeTypeName $nodeTypeName, PropertyCollection $properties, NodeName|null $name, NodeTags $tags, Timestamps $timestamps, VisibilityConstraints $visibilityConstraints)

No description

mixed
getProperty(PropertyName|string $propertyName)

Returns the specified property, or null if it does not exist (or was set to null -> unset)

bool
hasProperty(PropertyName|string $propertyName)

If this node has a property with the given name. It does not check if the property exists in the current NodeType schema.

bool
equals(Node $other)

Checks if the node's "Read Model" identity equals with the given one

Details

static Node create(ContentRepositoryId $contentRepositoryId, WorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $aggregateId, OriginDimensionSpacePoint $originDimensionSpacePoint, NodeAggregateClassification $classification, NodeTypeName $nodeTypeName, PropertyCollection $properties, NodeName|null $name, NodeTags $tags, Timestamps $timestamps, VisibilityConstraints $visibilityConstraints)

internal  The signature of this method can change in the future!
 

No description

Parameters

ContentRepositoryId $contentRepositoryId
WorkspaceName $workspaceName
DimensionSpacePoint $dimensionSpacePoint
NodeAggregateId $aggregateId
OriginDimensionSpacePoint $originDimensionSpacePoint
NodeAggregateClassification $classification
NodeTypeName $nodeTypeName
PropertyCollection $properties
NodeName|null $name
NodeTags $tags
Timestamps $timestamps
VisibilityConstraints $visibilityConstraints

Return Value

Node

mixed getProperty(PropertyName|string $propertyName)

Returns the specified property, or null if it does not exist (or was set to null -> unset)

Parameters

PropertyName|string $propertyName

Name of the property

Return Value

mixed

value of the property

bool hasProperty(PropertyName|string $propertyName)

If this node has a property with the given name. It does not check if the property exists in the current NodeType schema.

That means that {\Neos\ContentRepository\Core\Projection\ContentGraph\self::getProperty()} will not be null, except for the rare case the property deserializing returns null.

Parameters

PropertyName|string $propertyName

Name of the property

Return Value

bool

bool equals(Node $other)

Checks if the node's "Read Model" identity equals with the given one

Parameters

Node $other

Return Value

bool