neos / neos-development-collection

The unified repository containing the Neos core packages, used for Neos development.
https://www.neos.io/
GNU General Public License v3.0
260 stars 220 forks source link

WIP: TASK: Make Subgraph filter optional #5064

Open mhsdesign opened 1 month ago

mhsdesign commented 1 month ago

with this change (https://github.com/neos/neos-development-collection/commit/f25e44940f6629eb162783c622e7bf53878a9397#diff-35872d162c44bc083ae30164f7e89b289a61df55723ee599916b6372995612af) the filters where introduced for the subgraph. But the nullability got lost:

    public function findChildNodes(
         NodeAggregateId $parentNodeAggregateId,
         NodeTypeConstraints $nodeTypeConstraints = null,
         int $limit = null,
         int $offset = null
     ): Nodes;

changed to.

    public function findChildNodes(
         NodeAggregateId $parentNodeAggregateId,
         Filter\FindChildNodesFilter $filter
     ): Nodes;

Meaning an empty FindChildNodesFilter f.e. has always to be instantiated:

return $this->contentRepositoryRegistry->subgraphForNode($node)
    ->findChildNodes($node->aggregateId, FindChildNodesFilter::create());

though we should consider if it wouldnt be easier to make this param optional:

return $this->contentRepositoryRegistry->subgraphForNode($node)
    ->findChildNodes($node->aggregateId);

as it increases readability and usability.

Upgrade instructions

Review instructions

Checklist