Skip to content

Commit 15399be

Browse files
committed
check if node is nested set
1 parent 602b713 commit 15399be

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,13 @@ public function shiftRL(EntityManager $em, $class, $first, $delta, $root = null)
533533
if ($node instanceof Proxy && !$node->__isInitialized__) {
534534
continue;
535535
}
536-
if ($em->getClassMetadata(get_class($node))->name !== $meta->name) {
536+
537+
$nodeMeta = $em->getClassMetadata(get_class($node));
538+
539+
if (!array_key_exists($config['left'], $nodeMeta->getReflectionProperties())) {
537540
continue;
538541
}
542+
539543
$oid = spl_object_hash($node);
540544
$left = $meta->getReflectionProperty($config['left'])->getValue($node);
541545
$currentRoot = isset($config['root']) ? $meta->getReflectionProperty($config['root'])->getValue($node) : null;
@@ -602,9 +606,13 @@ public function shiftRangeRL(EntityManager $em, $class, $first, $last, $delta, $
602606
if ($node instanceof Proxy && !$node->__isInitialized__) {
603607
continue;
604608
}
605-
if ($em->getClassMetadata(get_class($node))->name !== $meta->name) {
609+
610+
$nodeMeta = $em->getClassMetadata(get_class($node));
611+
612+
if (!array_key_exists($config['left'], $nodeMeta->getReflectionProperties())) {
606613
continue;
607614
}
615+
608616
$left = $meta->getReflectionProperty($config['left'])->getValue($node);
609617
$right = $meta->getReflectionProperty($config['right'])->getValue($node);
610618
$currentRoot = isset($config['root']) ? $meta->getReflectionProperty($config['root'])->getValue($node) : null;

0 commit comments

Comments
 (0)