Skip to content

Commit d36628d

Browse files
committed
Fixed count in modify queries
1 parent eec078a commit d36628d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ public function execute(InputInterface $input, OutputInterface $output)
5252

5353
$start = microtime(true);
5454
$result = $query->execute();
55+
$rows = 0;
5556

5657
foreach ($result as $row) {
58+
$rows++;
5759
$node = $row->getNode();
5860
$node->remove();
5961
}
6062

6163
$elapsed = microtime(true) - $start;
62-
$output->writeln(sprintf('%s row(s) affected in %ss', count($result), number_format($elapsed, 2)));
64+
$output->writeln(sprintf('%s row(s) affected in %ss', $rows, number_format($elapsed, 2)));
6365
}
6466
}

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ public function execute(InputInterface $input, OutputInterface $output)
4646

4747
$start = microtime(true);
4848
$result = $query->execute();
49+
$rows = 0;
4950

5051
foreach ($result as $row) {
52+
$rows++;
5153
foreach ($updates as $field => $property) {
5254
$node = $row->getNode($property['selector']);
5355
$node->setProperty($property['name'], $property['value']);
@@ -56,6 +58,6 @@ public function execute(InputInterface $input, OutputInterface $output)
5658

5759
$elapsed = microtime(true) - $start;
5860

59-
$output->writeln(sprintf('%s row(s) affected in %ss', count($result), number_format($elapsed, 2)));
61+
$output->writeln(sprintf('%s row(s) affected in %ss', $rows, number_format($elapsed, 2)));
6062
}
6163
}

0 commit comments

Comments
 (0)