@@ -144,7 +144,7 @@ public function __call($method, $args)
144144 public function getPathQueryBuilder ($ node )
145145 {
146146 $ meta = $ this ->getClassMetadata ();
147- if (!$ node instanceof $ meta ->name ) {
147+ if (!is_a ( $ node, $ meta ->getName ()) ) {
148148 throw new InvalidArgumentException ('Node is not related to this repository ' );
149149 }
150150 $ config = $ this ->listener ->getConfiguration ($ this ->_em , $ meta ->name );
@@ -207,7 +207,7 @@ public function childrenQueryBuilder($node = null, $direct = false, $sortByField
207207 ->from ($ config ['useObjectClass ' ], 'node ' )
208208 ;
209209 if (null !== $ node ) {
210- if ($ node instanceof $ meta ->name ) {
210+ if (is_a ( $ node, $ meta ->getName ()) ) {
211211 $ wrapped = new EntityWrapper ($ node , $ this ->_em );
212212 if (!$ wrapped ->hasValidIdentifier ()) {
213213 throw new InvalidArgumentException ('Node is not managed by UnitOfWork ' );
@@ -330,7 +330,7 @@ public function getLeafsQueryBuilder($root = null, $sortByField = null, $directi
330330 ->where ($ qb ->expr ()->eq ('node. ' .$ config ['right ' ], '1 + node. ' .$ config ['left ' ]))
331331 ;
332332 if (isset ($ config ['root ' ])) {
333- if ($ root instanceof $ meta ->name ) {
333+ if (is_a ( $ root, $ meta ->getName ()) ) {
334334 $ wrapped = new EntityWrapper ($ root , $ this ->_em );
335335 $ rootId = $ wrapped ->getPropertyValue ($ config ['root ' ]);
336336 if (!$ rootId ) {
@@ -399,7 +399,7 @@ public function getLeafs($root = null, $sortByField = null, $direction = 'ASC')
399399 public function getNextSiblingsQueryBuilder ($ node , $ includeSelf = false )
400400 {
401401 $ meta = $ this ->getClassMetadata ();
402- if (!$ node instanceof $ meta ->name ) {
402+ if (!is_a ( $ node, $ meta ->getName ()) ) {
403403 throw new InvalidArgumentException ('Node is not related to this repository ' );
404404 }
405405 $ wrapped = new EntityWrapper ($ node , $ this ->_em );
@@ -476,7 +476,7 @@ public function getNextSiblings($node, $includeSelf = false)
476476 public function getPrevSiblingsQueryBuilder ($ node , $ includeSelf = false )
477477 {
478478 $ meta = $ this ->getClassMetadata ();
479- if (!$ node instanceof $ meta ->name ) {
479+ if (!is_a ( $ node, $ meta ->getName ()) ) {
480480 throw new InvalidArgumentException ('Node is not related to this repository ' );
481481 }
482482 $ wrapped = new EntityWrapper ($ node , $ this ->_em );
@@ -557,7 +557,7 @@ public function moveDown($node, $number = 1)
557557 {
558558 $ result = false ;
559559 $ meta = $ this ->getClassMetadata ();
560- if ($ node instanceof $ meta ->name ) {
560+ if (is_a ( $ node, $ meta ->getName ()) ) {
561561 $ nextSiblings = $ this ->getNextSiblings ($ node );
562562 if ($ numSiblings = count ($ nextSiblings )) {
563563 $ result = true ;
@@ -592,7 +592,7 @@ public function moveUp($node, $number = 1)
592592 {
593593 $ result = false ;
594594 $ meta = $ this ->getClassMetadata ();
595- if ($ node instanceof $ meta ->name ) {
595+ if (is_a ( $ node, $ meta ->getName ()) ) {
596596 $ prevSiblings = array_reverse ($ this ->getPrevSiblings ($ node ));
597597 if ($ numSiblings = count ($ prevSiblings )) {
598598 $ result = true ;
@@ -624,7 +624,7 @@ public function moveUp($node, $number = 1)
624624 public function removeFromTree ($ node )
625625 {
626626 $ meta = $ this ->getClassMetadata ();
627- if ($ node instanceof $ meta ->name ) {
627+ if (is_a ( $ node, $ meta ->getName ()) ) {
628628 $ wrapped = new EntityWrapper ($ node , $ this ->_em );
629629 $ config = $ this ->listener ->getConfiguration ($ this ->_em , $ meta ->name );
630630 $ right = $ wrapped ->getPropertyValue ($ config ['right ' ]);
@@ -744,7 +744,7 @@ public function removeFromTree($node)
744744 public function reorder ($ node , $ sortByField = null , $ direction = 'ASC ' , $ verify = true )
745745 {
746746 $ meta = $ this ->getClassMetadata ();
747- if ($ node instanceof $ meta -> name || null === $ node ) {
747+ if (null === $ node || is_a ( $ node, $ meta -> getName ()) ) {
748748 $ config = $ this ->listener ->getConfiguration ($ this ->_em , $ meta ->name );
749749 if ($ verify && is_array ($ this ->verify ())) {
750750 return false ;
0 commit comments