Skip to content

Commit d273468

Browse files
committed
Merge pull request #112 from phpcr/fix_node_references_command
Fixed behavior of node:references
2 parents e040c53 + e38bfd8 commit d273468

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4+
dev-master
5+
----------
6+
7+
- [node:references] Shows the referencing node paths instead of the referrered-to node path(s)
8+
49
alpha-6
510
-------
611

features/phpcr_node_references.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ Feature: Show node references
1313
Then the command should not fail
1414
And I should see a table containing the following rows:
1515
| Type | Property | Node Path |
16-
| weak | ref2 | /tests_general_base/idExample/jcr:content/weakreference_target |
17-
| weak | ref1 | /tests_general_base/idExample/jcr:content/weakreference_target |
16+
| weak | ref2 | /tests_general_base/idExample/jcr:content/weakreference_source2 |
17+
| weak | ref1 | /tests_general_base/idExample/jcr:content/weakreference_source1 |
1818

1919
Scenario: List named weak references
2020
Given the current node is "/tests_general_base/idExample/jcr:content/weakreference_target"
2121
And I execute the "node:references . ref2 --no-ansi" command
2222
Then the command should not fail
2323
And I should see a table containing the following rows:
2424
| Type | Property | Node Path |
25-
| weak | ref2 | /tests_general_base/idExample/jcr:content/weakreference_target |
25+
| weak | ref2 | /tests_general_base/idExample/jcr:content/weakreference_source2 |
2626

2727
Scenario: List strong references
2828
Given the current node is "/tests_general_base/idExample"
2929
And I execute the "node:references . --no-ansi" command
3030
Then the command should not fail
3131
And I should see a table containing the following rows:
3232
| Type | Property | Node Path |
33-
| strong | ref | /tests_general_base/idExample |
34-
| strong | multiref | /tests_general_base/idExample |
35-
| | | /tests_general_base/multiValueProperty |
33+
| strong | ref | /tests_general_base/numberPropertyNode/jcr:content |
34+
| strong | multiref | /tests_general_base/numberPropertyNode/jcr:content |
35+

src/PHPCR/Shell/Console/Command/Phpcr/NodeReferencesCommand.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,12 @@ public function execute(InputInterface $input, OutputInterface $output)
5959

6060
foreach ($references as $type => $typeReferences) {
6161
foreach ($typeReferences as $property) {
62-
if ($property->isMultiple()) {
63-
$nodes = $property->getNode();
64-
} else {
65-
$nodes = array($property->getNode());
66-
}
67-
68-
$nodePaths = array();
69-
70-
foreach ($nodes as $node) {
71-
$nodePaths[] = $node->getPath();
72-
}
62+
$nodePath = $property->getParent()->getPath();
7363

7464
$table->addRow(array(
7565
$type,
7666
$property->getName(),
77-
implode("\n", $nodePaths),
67+
$nodePath
7868
));
7969
}
8070
}

0 commit comments

Comments
 (0)