Skip to content

Commit

Permalink
Merge pull request #1669 from freshcells/v2.4.x
Browse files Browse the repository at this point in the history
Fix node deletion for similar paths with materialized path strategy (2.4.x)
  • Loading branch information
l3pp4rd authored Sep 22, 2016
2 parents b818880 + e8efad0 commit c2f308f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Gedmo/Tree/Strategy/ORM/MaterializedPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ public function removeNode($om, $meta, $config, $node)
$qb->select('e')
->from($config['useObjectClass'], 'e')
->where($qb->expr()->like('e.'.$config['path'], $qb->expr()->literal($path.'%')));

if (isset($config['level'])) {
$lvlField = $config['level'];
$lvl = $wrapped->getPropertyValue($lvlField);
if (!empty($lvl) && $meta->hasField($lvlField)) {
$qb->andWhere($qb->expr()->gt('e.' . $lvlField, $qb->expr()->literal($lvl)));
}
}

$results = $qb->getQuery()
->execute();

Expand Down

0 comments on commit c2f308f

Please sign in to comment.