Skip to content

Commit

Permalink
BUGFIX #3885 Node::countChildNodes($nodeTypeConstraints) filter doesn…
Browse files Browse the repository at this point in the history
…'t work

`findChildNodes` is corrently implemented, but `countChildNodes` doesnt transform the argument $nodeTypeConstraints NodeTypeConstraints to a string for the legacy api:

either this snipped must be included:
```php
$filter = $nodeTypeConstraints !== null ? $nodeTypeConstraints->asLegacyNodeTypeFilterString() : null;
```

or we must use `$this->findChildNodes`

without that, the `NodeTypeConstraints` is passed further down, and due to lack of typesafety it fails at the last moment:
```php
Argument 2 passed to Neos\Utility\Arrays::trimExplode() must be of the type string, object given, called in /tmp/neos/Development/SubContextddev/Cache/Code/Flow_Object_Classes/Neos_ContentRepository_Domain_Repository_NodeDataRepository.php on line 1127
```
  • Loading branch information
mhsdesign committed Oct 22, 2022
1 parent f3f6c77 commit 378a029
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Neos.ContentRepository/Classes/Domain/Model/Node.php
Expand Up @@ -2081,7 +2081,7 @@ public function findChildNodes(NodeTypeConstraints $nodeTypeConstraints = null,
*/
public function countChildNodes(NodeTypeConstraints $nodeTypeConstraints = null): int
{
return count($this->getChildNodes($nodeTypeConstraints));
return count($this->findChildNodes($nodeTypeConstraints));
}

/**
Expand Down

0 comments on commit 378a029

Please sign in to comment.