Skip to content

Commit 4935922

Browse files
authored
Merge pull request #1838 from Cosmologist/patch-2
More effective way to get column values
2 parents 79cd1d4 + 9644618 commit 4935922

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/Gedmo/Tree/Strategy/ORM/Closure.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -435,12 +435,8 @@ public function updateNode(EntityManager $em, $node, $oldParent)
435435
$subQuery .= " JOIN {$table} c2 ON c1.descendant = c2.descendant";
436436
$subQuery .= " WHERE c1.ancestor = :nodeId AND c2.depth > c1.depth";
437437

438-
$ids = $conn->fetchAll($subQuery, compact('nodeId'));
439-
if ($ids) {
440-
$ids = array_map(function ($el) {
441-
return $el['id'];
442-
}, $ids);
443-
438+
$ids = $conn->executeQuery($subQuery, compact('nodeId'))->fetchAll(\PDO::FETCH_COLUMN);
439+
if ($ids) {
444440
// using subquery directly, sqlite acts unfriendly
445441
$query = "DELETE FROM {$table} WHERE id IN (".implode(', ', $ids).")";
446442
if (!empty($ids) && !$conn->executeQuery($query)) {

0 commit comments

Comments
 (0)