Skip to content

Commit 8db1f69

Browse files
authored
Merge pull request #1866 from insekticid/patch-1
Fixed #1567 - [Tree] verify() - relation as root
2 parents d5fdc57 + 86ec9b1 commit 8db1f69

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/Gedmo/Tree/Entity/Repository/NestedTreeRepository.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,19 @@ private function verifyTree(&$errors, $root = null)
899899
$config = $this->listener->getConfiguration($this->_em, $meta->name);
900900

901901
$identifier = $meta->getSingleIdentifierFieldName();
902-
$rootId = isset($config['root']) ? $meta->getReflectionProperty($config['root'])->getValue($root) : null;
902+
if (isset($config['root'])) {
903+
if (isset($config['root'])) {
904+
$rootId = $meta->getReflectionProperty($config['root'])->getValue($root);
905+
if (is_object($rootId)) {
906+
$rootId = $meta->getReflectionProperty($identifier)->getValue($rootId);
907+
}
908+
} else {
909+
$rootId = null;
910+
}
911+
} else {
912+
$rootId = null;
913+
}
914+
903915
$qb = $this->getQueryBuilder();
904916
$qb->select($qb->expr()->min('node.'.$config['left']))
905917
->from($config['useObjectClass'], 'node')

0 commit comments

Comments
 (0)