Skip to content

FEATURE: Add count* queries to Content Subgraph #4124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 17, 2023

Conversation

bwaidelich
Copy link
Member

@bwaidelich bwaidelich commented Mar 17, 2023

Extends the ContentSubgraphInterface by the following four methods:

  • countChildNodes()
  • countDescendantNodes()
  • countReferences()
  • countBackReferences()

Example

$filter = FindChildNodesFilter::create()
    ->with(nodeTypeConstraint: 'Some.Included:NodeType')
    ->withPagination($limit, $offset);

$countFilter = CountChildNodesFilter::fromFindChildNodesFilter($filter);

$totalResults = $subgraph->countChildNodes($parentNodeAggregateId, $countFilter);
$paginatedNodes = $subgraph->findChildNodes($parentNodeAggregateId, $filter);

Related: #4075

Extends the `ContentSubgraphInterface` by the following four methods:
* `countChildNodes()`
* `countDescendantNodes()`
* `countReferences()`
* `countBackReferences()`

## Example

```php
$filter = FindChildNodesFilter::create()
    ->with(nodeTypeConstraint: 'Some.Included:NodeType')
    ->withPagination($limit, $offset);

$countFilter = CountChildNodesFilter::fromFindChildNodesFilter($filter);

$totalResults = $subgraph->countChildNodes($parentNodeAggregateId, $countFilter);
$paginatedNodes = $subgraph->findChildNodes($parentNodeAggregateId, $filter);
```
@bwaidelich bwaidelich marked this pull request as ready for review March 17, 2023 11:18
@skurfuerst
Copy link
Member

Looks perfectly fine :)

@skurfuerst skurfuerst merged commit f14e331 into 9.0 Mar 17, 2023
@skurfuerst skurfuerst deleted the feature/4075-content-subgraph-count-queries branch March 17, 2023 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants