interface ContentSubgraphInterface (View source)

This is the most important read model of a content repository.

It is a "view" to the content graph, only showing a single dimension (e.g. "language=de,country=ch") - so this means this is effectively a tree of nodes.

Accessing the Content Subgraph

From the central Content Repository instance, you can fetch the singleton {\Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphInterface}. There, you can call {\Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphInterface::getSubgraph()} and pass in the {\Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint} and {\Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints} you want to have.

Why is this called "Subgraph" and not Tree?

This is because a tree can have only a single root node, but the ContentSubgraph supports multiple root nodes. So the totally correct term would be a "Forest", but this is unknown terminology outside academia. This is why we go for "Subgraph" to show that this is a part of the Content Graph.

Methods

getWorkspaceName()

No description

Node|null
findNodeById(NodeAggregateId $nodeAggregateId)

Find a single node by its aggregate id

findNodesByIds(NodeAggregateIds $nodeAggregateIds)

Find all nodes by the specified aggregate ids

Node|null
findRootNodeByType(NodeTypeName $nodeTypeName)

Find a root node by its type Note that only one root node can exist per type as enforced by {RootNodeHandling}

findChildNodes(NodeAggregateId $parentNodeAggregateId, FindChildNodesFilter $filter)

Find direct child nodes of the specified parent node that match the given $filter

int
countChildNodes(NodeAggregateId $parentNodeAggregateId, CountChildNodesFilter $filter)

Count direct child nodes of the specified parent node that match the given $filter

Node|null
findParentNode(NodeAggregateId $childNodeAggregateId)

Find the direct parent of a node specified by its aggregate id

findSucceedingSiblingNodes(NodeAggregateId $siblingNodeAggregateId, FindSucceedingSiblingNodesFilter $filter)

Find all nodes that are positioned behind the specified sibling and match the specified $filter

findPrecedingSiblingNodes(NodeAggregateId $siblingNodeAggregateId, FindPrecedingSiblingNodesFilter $filter)

Find all nodes that are positioned before the specified sibling and match the specified $filter

findAncestorNodes(NodeAggregateId $entryNodeAggregateId, FindAncestorNodesFilter $filter)

Recursively find all nodes above the $entryNodeAggregateId that match the specified $filter and return them as a flat list

int
countAncestorNodes(NodeAggregateId $entryNodeAggregateId, CountAncestorNodesFilter $filter)

Count all nodes above the $entryNodeAggregateId that match the specified $filter

Node|null
findClosestNode(NodeAggregateId $entryNodeAggregateId, FindClosestNodeFilter $filter)

Find the closest matching node, the entry node itself or the first ancestors of the $entryNodeAggregateId, that match the specified $filter and return it Note: in contrast to {findAncestorNodes()} the resulting node will be the entry node if it matches the filter!

findDescendantNodes(NodeAggregateId $entryNodeAggregateId, FindDescendantNodesFilter $filter)

Recursively find all nodes underneath the $entryNodeAggregateId that match the specified $filter and return them as a flat list

int
countDescendantNodes(NodeAggregateId $entryNodeAggregateId, CountDescendantNodesFilter $filter)

Count all nodes underneath the $entryNodeAggregateId that match the specified $filter

Subtree|null
findSubtree(NodeAggregateId $entryNodeAggregateId, FindSubtreeFilter $filter)

Recursively find all nodes underneath the $entryNodeAggregateId that match the specified $filter and return them as a tree

findReferences(NodeAggregateId $nodeAggregateId, FindReferencesFilter $filter)

Find all "outgoing" references of a given node that match the specified $filter

int
countReferences(NodeAggregateId $nodeAggregateId, CountReferencesFilter $filter)

Count all "outgoing" references of a given node that match the specified $filter

findBackReferences(NodeAggregateId $nodeAggregateId, FindBackReferencesFilter $filter)

Find all "incoming" references of a given node that match the specified $filter If nodes "A" and "B" both have a reference to "C", the node "C" has two incoming references.

int
countBackReferences(NodeAggregateId $nodeAggregateId, CountBackReferencesFilter $filter)

Count all "incoming" references of a given node that match the specified $filter

Node|null
findNodeByPath(NodePath|NodeName $path, NodeAggregateId $startingNodeAggregateId)

Find a single node underneath $startingNodeAggregateId that matches the specified $path

Node|null
findNodeByAbsolutePath(AbsoluteNodePath $path)

Find a single node underneath that matches the specified absolute $path

retrieveNodePath(NodeAggregateId $nodeAggregateId) deprecated

Determine the absolute path of a node

int
countNodes()

Count all nodes in this subgraph, including inaccessible ones!

Details

ContentRepositoryId getContentRepositoryId()

No description

Return Value

ContentRepositoryId

WorkspaceName getWorkspaceName()

No description

Return Value

WorkspaceName

DimensionSpacePoint getDimensionSpacePoint()

No description

Return Value

DimensionSpacePoint

VisibilityConstraints getVisibilityConstraints()

No description

Return Value

VisibilityConstraints

Node|null findNodeById(NodeAggregateId $nodeAggregateId)

Find a single node by its aggregate id

Parameters

NodeAggregateId $nodeAggregateId

Return Value

Node|null

the node or NULL if no node with the specified id is accessible in this subgraph

Nodes findNodesByIds(NodeAggregateIds $nodeAggregateIds)

Find all nodes by the specified aggregate ids

Parameters

NodeAggregateIds $nodeAggregateIds

Return Value

Nodes

the nodes that exist in this subgraph. The order is not defined.

Node|null findRootNodeByType(NodeTypeName $nodeTypeName)

Find a root node by its type Note that only one root node can exist per type as enforced by {RootNodeHandling}

Parameters

NodeTypeName $nodeTypeName

Return Value

Node|null

the node or null if no root node with the specified type is accessible in this subgraph

Nodes findChildNodes(NodeAggregateId $parentNodeAggregateId, FindChildNodesFilter $filter)

Find direct child nodes of the specified parent node that match the given $filter

Parameters

NodeAggregateId $parentNodeAggregateId
FindChildNodesFilter $filter

Return Value

Nodes

int countChildNodes(NodeAggregateId $parentNodeAggregateId, CountChildNodesFilter $filter)

Count direct child nodes of the specified parent node that match the given $filter

Parameters

NodeAggregateId $parentNodeAggregateId
CountChildNodesFilter $filter

Return Value

int

See also

findChildNodes

Node|null findParentNode(NodeAggregateId $childNodeAggregateId)

Find the direct parent of a node specified by its aggregate id

Parameters

NodeAggregateId $childNodeAggregateId

Return Value

Node|null

the node or NULL if the specified node is the root node or is inaccessible

Nodes findSucceedingSiblingNodes(NodeAggregateId $siblingNodeAggregateId, FindSucceedingSiblingNodesFilter $filter)

Find all nodes that are positioned behind the specified sibling and match the specified $filter

Parameters

NodeAggregateId $siblingNodeAggregateId
FindSucceedingSiblingNodesFilter $filter

Return Value

Nodes

Nodes findPrecedingSiblingNodes(NodeAggregateId $siblingNodeAggregateId, FindPrecedingSiblingNodesFilter $filter)

Find all nodes that are positioned before the specified sibling and match the specified $filter

Parameters

NodeAggregateId $siblingNodeAggregateId
FindPrecedingSiblingNodesFilter $filter

Return Value

Nodes

Nodes findAncestorNodes(NodeAggregateId $entryNodeAggregateId, FindAncestorNodesFilter $filter)

Recursively find all nodes above the $entryNodeAggregateId that match the specified $filter and return them as a flat list

Parameters

NodeAggregateId $entryNodeAggregateId
FindAncestorNodesFilter $filter

Return Value

Nodes

int countAncestorNodes(NodeAggregateId $entryNodeAggregateId, CountAncestorNodesFilter $filter)

Count all nodes above the $entryNodeAggregateId that match the specified $filter

Parameters

NodeAggregateId $entryNodeAggregateId
CountAncestorNodesFilter $filter

Return Value

int

See also

findAncestorNodes

Node|null findClosestNode(NodeAggregateId $entryNodeAggregateId, FindClosestNodeFilter $filter)

Find the closest matching node, the entry node itself or the first ancestors of the $entryNodeAggregateId, that match the specified $filter and return it Note: in contrast to {findAncestorNodes()} the resulting node will be the entry node if it matches the filter!

Parameters

NodeAggregateId $entryNodeAggregateId
FindClosestNodeFilter $filter

Return Value

Node|null

the closest node that matches the given $filter, or NULL if no matching node was found

Nodes findDescendantNodes(NodeAggregateId $entryNodeAggregateId, FindDescendantNodesFilter $filter)

Recursively find all nodes underneath the $entryNodeAggregateId that match the specified $filter and return them as a flat list

Note: This is basically a set-based view of descendant nodes; so the ordering should not be relied upon

Parameters

NodeAggregateId $entryNodeAggregateId
FindDescendantNodesFilter $filter

Return Value

Nodes

int countDescendantNodes(NodeAggregateId $entryNodeAggregateId, CountDescendantNodesFilter $filter)

Count all nodes underneath the $entryNodeAggregateId that match the specified $filter

Parameters

NodeAggregateId $entryNodeAggregateId
CountDescendantNodesFilter $filter

Return Value

int

See also

findDescendantNodes

Subtree|null findSubtree(NodeAggregateId $entryNodeAggregateId, FindSubtreeFilter $filter)

Recursively find all nodes underneath the $entryNodeAggregateId that match the specified $filter and return them as a tree

Note: This returns a fragment of the existing tree structure. The structure is kept intact but nodes might be missing depending on the specified filter

Parameters

NodeAggregateId $entryNodeAggregateId
FindSubtreeFilter $filter

Return Value

Subtree|null

the recursive tree of all matching nodes, or NULL if the entry node is not accessible

References findReferences(NodeAggregateId $nodeAggregateId, FindReferencesFilter $filter)

Find all "outgoing" references of a given node that match the specified $filter

Because each reference has a name and can contain properties itself, this method does not return the target nodes directly, but a collection of references {\Neos\ContentRepository\Core\Projection\ContentGraph\References}. The corresponding nodes can be retrieved via {\Neos\ContentRepository\Core\Projection\ContentGraph\References::getNodes()}

Parameters

NodeAggregateId $nodeAggregateId
FindReferencesFilter $filter

Return Value

References

int countReferences(NodeAggregateId $nodeAggregateId, CountReferencesFilter $filter)

Count all "outgoing" references of a given node that match the specified $filter

Parameters

NodeAggregateId $nodeAggregateId
CountReferencesFilter $filter

Return Value

int

See also

findReferences

References findBackReferences(NodeAggregateId $nodeAggregateId, FindBackReferencesFilter $filter)

Find all "incoming" references of a given node that match the specified $filter If nodes "A" and "B" both have a reference to "C", the node "C" has two incoming references.

Parameters

NodeAggregateId $nodeAggregateId
FindBackReferencesFilter $filter

Return Value

References

See also

findReferences

int countBackReferences(NodeAggregateId $nodeAggregateId, CountBackReferencesFilter $filter)

Count all "incoming" references of a given node that match the specified $filter

Parameters

NodeAggregateId $nodeAggregateId
CountBackReferencesFilter $filter

Return Value

int

See also

findBackReferences

Node|null findNodeByPath(NodePath|NodeName $path, NodeAggregateId $startingNodeAggregateId)

Find a single node underneath $startingNodeAggregateId that matches the specified $path

If a node name as $path is given it will be treated as path with a single segment.

NOTE: This operation is most likely to be deprecated since the concept of node paths is not really used in the core, and it has some logical issues

Parameters

NodePath|NodeName $path
NodeAggregateId $startingNodeAggregateId

Return Value

Node|null

the node that matches the given $path, or NULL if no node on that path is accessible

Node|null findNodeByAbsolutePath(AbsoluteNodePath $path)

Find a single node underneath that matches the specified absolute $path

NOTE: This operation is most likely to be deprecated since the concept of node paths is not really used in the core, and it has some logical issues

Parameters

AbsoluteNodePath $path

Return Value

Node|null

the node that matches the given $path, or NULL if no node on that path is accessible

AbsoluteNodePath retrieveNodePath(NodeAggregateId $nodeAggregateId) deprecated

deprecated use {@see \Neos\ContentRepository\Core\Projection\ContentGraph\self::findAncestorNodes()} in combination with {@see \Neos\ContentRepository\Core\Projection\ContentGraph\AbsoluteNodePath::fromLeafNodeAndAncestors()} instead

Determine the absolute path of a node

Parameters

NodeAggregateId $nodeAggregateId

Return Value

AbsoluteNodePath

Exceptions

InvalidArgumentException

int countNodes()

internal  this method might change without further notice.
 

Count all nodes in this subgraph, including inaccessible ones!

Return Value

int