Skip to content

Commit f956c3c

Browse files
Merge pull request #2217 from stephanvierkant/stephanvierkant-materializedpath-delete
[Tree][MaterializedPath] Use path_separator when removing children
2 parents 320adb6 + 26d9a2e commit f956c3c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Tree/Strategy/ORM/MaterializedPath.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ public function removeNode($om, $meta, $config, $node)
2424

2525
$path = addcslashes($wrapped->getPropertyValue($config['path']), '%');
2626

27+
$separator = $config['path_ends_with_separator'] ? null : $config['path_separator'];
28+
2729
// Remove node's children
2830
$qb = $om->createQueryBuilder();
2931
$qb->select('e')
3032
->from($config['useObjectClass'], 'e')
31-
->where($qb->expr()->like('e.'.$config['path'], $qb->expr()->literal($path.'%')));
33+
->where($qb->expr()->like('e.'.$config['path'], $qb->expr()->literal($path.$separator.'%')));
3234

3335
if (isset($config['level'])) {
3436
$lvlField = $config['level'];

0 commit comments

Comments
 (0)