Skip to content

Commit e7a6aae

Browse files
committed
Use Connection::executeStatement() for "DELETE" statements
1 parent 3f053f8 commit e7a6aae

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ a release.
2020

2121
## [Unreleased]
2222
### Fixed
23+
- Tree: Check for affected rows at `ClosureTreeRepository::cleanUpClosure()` and `Closure::updateNode()`.
2324
- `Gedmo\Mapping\Driver\Xml::_loadMappingFile()` behavior in scenarios where `libxml_disable_entity_loader(true)` was previously
2425
called.
2526
- Loggable: Missing support for `versioned` fields at `attribute-override` in XML mapping.

src/Tree/Entity/Repository/ClosureTreeRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ public function cleanUpClosure()
552552
return $el['id'];
553553
}, $ids);
554554
$query = "DELETE FROM {$closureTableName} WHERE id IN (".implode(', ', $ids).')';
555-
if (!$conn->executeQuery($query)) {
555+
if (0 === $conn->executeStatement($query)) {
556556
throw new \RuntimeException('Failed to remove incorrect closures');
557557
}
558558
$deletedClosuresCount += count($ids);

src/Tree/Strategy/ORM/Closure.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ public function updateNode(EntityManagerInterface $em, $node, $oldParent)
439439
if ([] !== $ids) {
440440
// using subquery directly, sqlite acts unfriendly
441441
$query = "DELETE FROM {$table} WHERE id IN (".implode(', ', $ids).')';
442-
if (!$conn->executeQuery($query)) {
442+
if (0 === $conn->executeStatement($query)) {
443443
throw new RuntimeException('Failed to remove old closures');
444444
}
445445
}

0 commit comments

Comments
 (0)