diff --git a/lib/Gedmo/Tree/Strategy/ORM/MaterializedPath.php b/lib/Gedmo/Tree/Strategy/ORM/MaterializedPath.php index 959cd0d334..e5cc506950 100644 --- a/lib/Gedmo/Tree/Strategy/ORM/MaterializedPath.php +++ b/lib/Gedmo/Tree/Strategy/ORM/MaterializedPath.php @@ -30,7 +30,8 @@ public function removeNode($om, $meta, $config, $node) $qb = $om->createQueryBuilder(); $qb->select('e') ->from($config['useObjectClass'], 'e') - ->where($qb->expr()->like('e.'.$config['path'], $qb->expr()->literal($path.'%'))); + ->where($qb->expr()->like('e.'.$config['path'], $qb->expr()->literal($path.'%'))) + ->andWhere($qb->expr()->neq('e.'.$config['path'], $qb->expr()->literal($path))); $results = $qb->getQuery() ->execute();