Skip to content

Commit 9e9bada

Browse files
committed
Show UUID's in references
1 parent 2188e6e commit 9e9bada

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ public function execute(InputInterface $input, OutputInterface $output)
5656

5757
$table = $this->get('helper.table')->create();
5858
$table->setHeaders(array(
59-
'Type', 'Property', 'Node Path'
59+
'Path', 'Property', 'Type',
6060
));
6161

6262
foreach ($references as $type => $typeReferences) {
6363
foreach ($typeReferences as $property) {
6464
$nodePath = $property->getParent()->getPath();
6565

6666
$table->addRow(array(
67-
$type,
67+
$nodePath,
6868
$property->getName(),
69-
$nodePath
69+
$type,
7070
));
7171
}
7272
}

src/PHPCR/Shell/Console/Helper/ResultFormatterHelper.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,19 @@ public function getPropertyTypeName($typeInteger)
5454
*/
5555
public function formatQueryResult(QueryResultInterface $result, OutputInterface $output, $elapsed)
5656
{
57-
$selectorNames = $result->getSelectorNames();
58-
5957
$table = $this->tableHelper->create();
6058
$table->setHeaders(array_merge(array(
6159
'Path',
6260
'Index',
6361
), $result->getColumnNames()));
6462

65-
foreach ($result->getRows() as $i => $row) {
63+
foreach ($result->getRows() as $row) {
6664
$values = array_merge(array(
6765
$row->getPath(),
6866
$row->getNode()->getIndex(),
6967
), $row->getValues());
7068

71-
foreach ($values as $columnName => &$value) {
69+
foreach ($values as &$value) {
7270
$value = $this->normalizeValue($value);
7371
}
7472

@@ -90,13 +88,17 @@ public function normalizeValue($value)
9088

9189
foreach ($array as $i => $value) {
9290
if ($value instanceof NodeInterface) {
91+
$uuid = $value->getIdentifier();
9392
$value = $value->getPath();
93+
if ($uuid) {
94+
$value .= ' (' . $uuid . ')';
95+
}
9496
} elseif (is_object($value)) {
9597
$value = '<UNKNOWN OBJECT>';
9698
} else {
9799
$value = $value;
98100
}
99-
$value = '[' . $i . '] ' . $this->textHelper->truncate($value);
101+
$value = '[' . $i . '] ' . $this->textHelper->truncate($value, 255);
100102
$values[] = $value;
101103
}
102104

@@ -112,10 +114,8 @@ public function normalizeValue($value)
112114

113115
public function formatValue(PropertyInterface $value, $showBinary = false)
114116
{
115-
$v = $value->getValue();
116-
117-
if (is_array($v)) {
118-
return $this->normalizeValue($v);
117+
if (is_array($value->getValue())) {
118+
return $this->normalizeValue($value->getValue());
119119
}
120120

121121
switch (intval($value->getType())) {

0 commit comments

Comments
 (0)