-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from neos/bugfix/refactor-node-get-child-nodes
BUGFIX: Refactor Node::getChildNodes rector refactoring
- Loading branch information
Showing
7 changed files
with
166 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
tests/Rules/NodeGetChildNodesRector/Fixture/all-with-pagination-named-arguments.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
use Neos\ContentRepository\Core\Projection\ContentGraph\Node; | ||
|
||
class SomeClass | ||
{ | ||
public function run(Node $node) | ||
{ | ||
foreach ($node->getChildNodes(offset: 100, limit: 10) as $node) { | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
use Neos\ContentRepository\Core\Projection\ContentGraph\Node; | ||
|
||
class SomeClass | ||
{ | ||
public function run(Node $node) | ||
{ | ||
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); | ||
// TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call. | ||
|
||
foreach (iterator_to_array($subgraph->findChildNodes($node->nodeAggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter::create(pagination: ['limit' => 10, 'offset' => 100]))) as $node) { | ||
} | ||
} | ||
} | ||
|
||
?> |
32 changes: 32 additions & 0 deletions
32
tests/Rules/NodeGetChildNodesRector/Fixture/all-with-pagination.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
use Neos\ContentRepository\Core\Projection\ContentGraph\Node; | ||
|
||
class SomeClass | ||
{ | ||
public function run(Node $node) | ||
{ | ||
foreach ($node->getChildNodes(null, 10,100) as $node) { | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
use Neos\ContentRepository\Core\Projection\ContentGraph\Node; | ||
|
||
class SomeClass | ||
{ | ||
public function run(Node $node) | ||
{ | ||
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); | ||
// TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call. | ||
|
||
foreach (iterator_to_array($subgraph->findChildNodes($node->nodeAggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter::create(pagination: ['limit' => 10, 'offset' => 100]))) as $node) { | ||
} | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
tests/Rules/NodeGetChildNodesRector/Fixture/nodetype-filter-with-pagination.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
use Neos\ContentRepository\Core\Projection\ContentGraph\Node; | ||
|
||
class SomeClass | ||
{ | ||
public function run(Node $node) | ||
{ | ||
foreach ($node->getChildNodes('Neos.Neos:Document', 10, 100) as $node) { | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
use Neos\ContentRepository\Core\Projection\ContentGraph\Node; | ||
|
||
class SomeClass | ||
{ | ||
public function run(Node $node) | ||
{ | ||
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); | ||
// TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call. | ||
|
||
foreach (iterator_to_array($subgraph->findChildNodes($node->nodeAggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter::create(nodeTypeConstraints: 'Neos.Neos:Document', pagination: ['limit' => 10, 'offset' => 100]))) as $node) { | ||
} | ||
} | ||
} | ||
|
||
?> |
32 changes: 32 additions & 0 deletions
32
tests/Rules/NodeGetChildNodesRector/Fixture/nodetype-filter.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
use Neos\ContentRepository\Core\Projection\ContentGraph\Node; | ||
|
||
class SomeClass | ||
{ | ||
public function run(Node $node) | ||
{ | ||
foreach ($node->getChildNodes('Neos.Neos:Document') as $node) { | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
use Neos\ContentRepository\Core\Projection\ContentGraph\Node; | ||
|
||
class SomeClass | ||
{ | ||
public function run(Node $node) | ||
{ | ||
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); | ||
// TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call. | ||
|
||
foreach (iterator_to_array($subgraph->findChildNodes($node->nodeAggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter::create(nodeTypeConstraints: 'Neos.Neos:Document'))) as $node) { | ||
} | ||
} | ||
} | ||
|
||
?> |