Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint;
use Neos\ContentRepository\Core\NodeType\NodeTypeManager;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphInterface;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindDescendantNodesFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindPrecedingSiblingNodesFilter;
Expand Down Expand Up @@ -127,6 +128,12 @@ public function findChildNodes(
);
}

public function countChildNodes(NodeAggregateId $parentNodeAggregateId, Filter\CountChildNodesFilter $filter): int
{
// TODO: Implement countChildNodes() method.
return 0;
}

public function findReferences(
NodeAggregateId $nodeAggregateId,
FindReferencesFilter $filter
Expand Down Expand Up @@ -158,6 +165,12 @@ public function findReferences(
);
}

public function countReferences(NodeAggregateId $nodeAggregateId, Filter\CountReferencesFilter $filter): int
{
// TODO: Implement countReferences() method.
return 0;
}

public function findBackReferences(
NodeAggregateId $nodeAggregateId,
FindBackReferencesFilter $filter
Expand Down Expand Up @@ -190,6 +203,12 @@ public function findBackReferences(
);
}

public function countBackReferences(NodeAggregateId $nodeAggregateId, Filter\CountBackReferencesFilter $filter): int
{
// TODO: Implement countBackReferences() method.
return 0;
}

public function findParentNode(NodeAggregateId $childNodeAggregateId): ?Node
{
$query = HypergraphParentQuery::create($this->contentStreamIdentifier, $this->tableNamePrefix);
Expand Down Expand Up @@ -408,6 +427,13 @@ public function findDescendantNodes(
return Nodes::createEmpty();
}


public function countDescendantNodes(NodeAggregateId $entryNodeAggregateId, Filter\CountDescendantNodesFilter $filter): int
{
// TODO: Implement countDescendantNodes() method.
return 0;
}

/**
* @throws \Doctrine\DBAL\Driver\Exception
* @throws \Doctrine\DBAL\Exception
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
@contentrepository @adapters=DoctrineDBAL
# TODO implement for Postgres
Feature: Count nodes using the countBackReferences query

Background:
Given I have the following content dimensions:
| Identifier | Values | Generalizations |
| language | mul, de, en, ch | ch->de->mul, en->mul |
And I have the following NodeTypes configuration:
"""
'Neos.ContentRepository:Root': []
'Neos.ContentRepository.Testing:AbstractPage':
abstract: true
properties:
text:
type: string
refs:
type: references
properties:
foo:
type: string
ref:
type: reference
properties:
foo:
type: string
'Neos.ContentRepository.Testing:SomeMixin':
abstract: true
'Neos.ContentRepository.Testing:Homepage':
superTypes:
'Neos.ContentRepository.Testing:AbstractPage': true
childNodes:
terms:
type: 'Neos.ContentRepository.Testing:Terms'
contact:
type: 'Neos.ContentRepository.Testing:Contact'

'Neos.ContentRepository.Testing:Terms':
superTypes:
'Neos.ContentRepository.Testing:AbstractPage': true
properties:
text:
defaultValue: 'Terms default'
'Neos.ContentRepository.Testing:Contact':
superTypes:
'Neos.ContentRepository.Testing:AbstractPage': true
'Neos.ContentRepository.Testing:SomeMixin': true
properties:
text:
defaultValue: 'Contact default'
'Neos.ContentRepository.Testing:Page':
superTypes:
'Neos.ContentRepository.Testing:AbstractPage': true
'Neos.ContentRepository.Testing:SpecialPage':
superTypes:
'Neos.ContentRepository.Testing:AbstractPage': true
"""
And I am user identified by "initiating-user-identifier"
And the command CreateRootWorkspace is executed with payload:
| Key | Value |
| workspaceName | "live" |
| workspaceTitle | "Live" |
| workspaceDescription | "The live workspace" |
| newContentStreamId | "cs-identifier" |
And the graph projection is fully up to date
And I am in content stream "cs-identifier" and dimension space point {"language":"de"}
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.ContentRepository:Root" |
And the graph projection is fully up to date
And the following CreateNodeAggregateWithNode commands are executed:
| nodeAggregateId | nodeName | nodeTypeName | parentNodeAggregateId | initialPropertyValues | tetheredDescendantNodeAggregateIds |
| home | home | Neos.ContentRepository.Testing:Homepage | lady-eleonode-rootford | {} | {"terms": "terms", "contact": "contact"} |
| c | c | Neos.ContentRepository.Testing:Page | home | {"text": "c"} | {} |
| a | a | Neos.ContentRepository.Testing:Page | home | {"text": "a"} | {} |
| a1 | a1 | Neos.ContentRepository.Testing:Page | a | {"text": "a1"} | {} |
| a2 | a2 | Neos.ContentRepository.Testing:Page | a | {"text": "a2"} | {} |
| a2a | a2a | Neos.ContentRepository.Testing:SpecialPage | a2 | {"text": "a2a"} | {} |
| a2a1 | a2a1 | Neos.ContentRepository.Testing:Page | a2a | {"text": "a2a1"} | {} |
| a2a2 | a2a2 | Neos.ContentRepository.Testing:Page | a2a | {"text": "a2a2"} | {} |
| a2a3 | a2a3 | Neos.ContentRepository.Testing:Page | a2a | {"text": "a2a3"} | {} |
| a3 | a3 | Neos.ContentRepository.Testing:Page | a | {"text": "a3"} | {} |
| b | b | Neos.ContentRepository.Testing:Page | home | {"text": "b"} | {} |
| b1 | b1 | Neos.ContentRepository.Testing:Page | b | {"text": "b1"} | {} |
And the command SetNodeReferences is executed with payload:
| Key | Value |
| sourceNodeAggregateId | "c" |
| referenceName | "refs" |
| references | [{"target":"b1", "properties": {"foo": "foos"}}] |
And the command SetNodeReferences is executed with payload:
| Key | Value |
| sourceNodeAggregateId | "a" |
| referenceName | "refs" |
| references | [{"target":"b1"}, {"target":"a2a2"}] |
And the command SetNodeReferences is executed with payload:
| Key | Value |
| sourceNodeAggregateId | "b1" |
| referenceName | "ref" |
| references | [{"target":"a"}] |
And the command SetNodeReferences is executed with payload:
| Key | Value |
| sourceNodeAggregateId | "b" |
| referenceName | "refs" |
| references | [{"target":"a3", "properties": {"foo": "bar"}}, {"target":"a2a1", "properties": {"foo": "baz"}}] |
And the command SetNodeReferences is executed with payload:
| Key | Value |
| sourceNodeAggregateId | "a" |
| referenceName | "refs" |
| references | [{"target":"b1", "properties": {"foo": "bar"}}, {"target": "b"}] |
And the command SetNodeReferences is executed with payload:
| Key | Value |
| sourceNodeAggregateId | "a2" |
| referenceName | "ref" |
| references | [{"target":"a2a3"}] |
And the command SetNodeReferences is executed with payload:
| Key | Value |
| sourceNodeAggregateId | "a2a3" |
| referenceName | "ref" |
| references | [{"target":"a2"}] |
And the command DisableNodeAggregate is executed with payload:
| Key | Value |
| nodeAggregateId | "a2a3" |
| nodeVariantSelectionStrategy | "allVariants" |
And the graph projection is fully up to date

Scenario: countBackReferences queries with empty results
When I execute the countBackReferences query for node aggregate id "non-existing" I expect the result 0
When I execute the countBackReferences query for node aggregate id "home" I expect the result 0
# "a2" is references node "a2a3" but "a2a3" is disabled so this reference should be ignored
When I execute the countBackReferences query for node aggregate id "a2" I expect the result 0
# "a2a3" is references node "a2" but "a2a3" is disabled so this reference should be ignored
When I execute the countBackReferences query for node aggregate id "a2a3" I expect the result 0
When I execute the countBackReferences query for node aggregate id "a" and filter '{"referenceName": "non-existing"}' I expect the result 0

Scenario: countBackReferences queries with results
When I execute the countBackReferences query for node aggregate id "a" I expect the result 1
When I execute the countBackReferences query for node aggregate id "a3" and filter '{"referenceName": "refs"}' I expect the result 1
When I execute the countBackReferences query for node aggregate id "b1" I expect the result 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
@contentrepository @adapters=DoctrineDBAL
# TODO implement for Postgres
Feature: Count nodes using the countChildNodes query

Background:
Given I have the following content dimensions:
| Identifier | Values | Generalizations |
| language | mul, de, en, ch | ch->de->mul, en->mul |
And I have the following NodeTypes configuration:
"""
'Neos.ContentRepository:Root': []
'Neos.ContentRepository.Testing:AbstractPage':
abstract: true
properties:
text:
type: string
'Neos.ContentRepository.Testing:SomeMixin':
abstract: true
'Neos.ContentRepository.Testing:Homepage':
superTypes:
'Neos.ContentRepository.Testing:AbstractPage': true
childNodes:
terms:
type: 'Neos.ContentRepository.Testing:Terms'
contact:
type: 'Neos.ContentRepository.Testing:Contact'

'Neos.ContentRepository.Testing:Terms':
superTypes:
'Neos.ContentRepository.Testing:AbstractPage': true
properties:
text:
defaultValue: 'Terms default'
'Neos.ContentRepository.Testing:Contact':
superTypes:
'Neos.ContentRepository.Testing:AbstractPage': true
'Neos.ContentRepository.Testing:SomeMixin': true
properties:
text:
defaultValue: 'Contact default'
'Neos.ContentRepository.Testing:Page':
superTypes:
'Neos.ContentRepository.Testing:AbstractPage': true
'Neos.ContentRepository.Testing:SpecialPage':
superTypes:
'Neos.ContentRepository.Testing:AbstractPage': true
"""
And I am user identified by "initiating-user-identifier"
And the command CreateRootWorkspace is executed with payload:
| Key | Value |
| workspaceName | "live" |
| workspaceTitle | "Live" |
| workspaceDescription | "The live workspace" |
| newContentStreamId | "cs-identifier" |
And the graph projection is fully up to date
And I am in content stream "cs-identifier" and dimension space point {"language":"de"}
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.ContentRepository:Root" |
And the graph projection is fully up to date
And the following CreateNodeAggregateWithNode commands are executed:
| nodeAggregateId | nodeTypeName | parentNodeAggregateId | initialPropertyValues | tetheredDescendantNodeAggregateIds |
| home | Neos.ContentRepository.Testing:Homepage | lady-eleonode-rootford | {} | {"terms": "terms", "contact": "contact"} |
| a | Neos.ContentRepository.Testing:Page | home | {"text": "a"} | {} |
| a1 | Neos.ContentRepository.Testing:Page | a | {"text": "a1"} | {} |
| a2 | Neos.ContentRepository.Testing:Page | a | {"text": "a2"} | {} |
| a2a | Neos.ContentRepository.Testing:SpecialPage | a2 | {"text": "a2a"} | {} |
| a2a1 | Neos.ContentRepository.Testing:Page | a2a | {"text": "a2a1"} | {} |
| a2a2 | Neos.ContentRepository.Testing:Page | a2a | {"text": "a2a2"} | {} |
| a2a3 | Neos.ContentRepository.Testing:Page | a2a | {"text": "a2a3"} | {} |
| b | Neos.ContentRepository.Testing:Page | home | {"text": "b"} | {} |
| b1 | Neos.ContentRepository.Testing:Page | b | {"text": "b1"} | {} |
And the command DisableNodeAggregate is executed with payload:
| Key | Value |
| nodeAggregateId | "a2a3" |
| nodeVariantSelectionStrategy | "allVariants" |
And the graph projection is fully up to date

Scenario: Child nodes without filter
When I execute the countChildNodes query for parent node aggregate id "home" I expect the result 4
When I execute the countChildNodes query for parent node aggregate id "a" I expect the result 2
When I execute the countChildNodes query for parent node aggregate id "a1" I expect the result 0
When I execute the countChildNodes query for parent node aggregate id "a2a" I expect the result 2

Scenario: Child nodes filtered by node type
When I execute the countChildNodes query for parent node aggregate id "home" and filter '{"nodeTypeConstraints": "Neos.ContentRepository.Testing:AbstractPage"}' I expect the result 4
When I execute the countChildNodes query for parent node aggregate id "home" and filter '{"nodeTypeConstraints": "Neos.ContentRepository.Testing:SomeMixin"}' I expect the result 1
When I execute the countChildNodes query for parent node aggregate id "home" and filter '{"nodeTypeConstraints": "Neos.ContentRepository.Testing:SomeMixin"}' I expect the result 1
When I execute the countChildNodes query for parent node aggregate id "home" and filter '{"nodeTypeConstraints": "Neos.ContentRepository.Testing:AbstractPage,!Neos.ContentRepository.Testing:SomeMixin"}' I expect the result 3
When I execute the countChildNodes query for parent node aggregate id "home" and filter '{"nodeTypeConstraints": "Neos.ContentRepository.Testing:NonExistingNodeType"}' I expect the result 0
Loading