public function moveAsLastChildOf(NodeWrapper $node)
    {
        if($node == $this)
        {
            throw new \InvalidArgumentException('Cannot move node as a child of itself');
        }

        $em = $this->getManager()->getEntityManager();

        // beginTransaction
        $em->getConnection()->beginTransaction();
        try
        {
            if($this->hasManyRoots() && $this->getRootValue() !== $node->getRootValue())
            {
                $this->moveBetweenTrees($node, $node->getRightValue(), __FUNCTION__);
            }
            else
            {
                $this->updateNode($node->getRightValue());
            }

            $em->flush();
            $em->getConnection()->commit();
        }
        catch (\Exception $e)
        {
            // @codeCoverageIgnoreStart
            $em->close();
            $em->getConnection()->rollback();
            throw $e;
            // @codeCoverageIgnoreEnd
        }
        // endTransaction
    }
public function moveAsLastChildOf(NodeWrapper $node)
    {
        if($node == $this)
        {
            throw new \InvalidArgumentException('Cannot move node as a child of itself');
        }

        $em = $this->getManager()->getEntityManager();

        // beginTransaction
        $em->getConnection()->beginTransaction();
        try
        {
            if($this->hasManyRoots() && $this->getRootValue() !== $node->getRootValue())
            {
                $this->moveBetweenTrees($node, $node->getRightValue(), __FUNCTION__);
            }
            else
            {
                $this->updateNode($node->getRightValue());
            }

            $em->flush();
            $em->getConnection()->commit();
        }
        catch (\Exception $e)
        {
            // @codeCoverageIgnoreStart
            $em->close();
            $em->getConnection()->rollback();
            throw $e;
            // @codeCoverageIgnoreEnd
        }
        // endTransaction
    }
public function moveAsLastChildOf ( NodeWrapper $ node ) { if ( $ node == $ this ) { throw new \ InvalidArgumentException ( 'Cannot move node as a child of itself' ) ; } $ em = $ this -> getManager ( ) -> getEntityManager ( ) ; // beginTransaction $ em -> getConnection ( ) -> beginTransaction ( ) ; try { if ( $ this -> hasManyRoots ( ) && $ this -> getRootValue ( ) !== $ node -> getRootValue ( ) ) { $ this -> moveBetweenTrees ( $ node , $ node -> getRightValue ( ) , __FUNCTION__ ) ; } else { $ this -> updateNode ( $ node -> getRightValue ( ) ) ; } $ em -> flush ( ) ; $ em -> getConnection ( ) -> commit ( ) ; } catch ( \ Exception $ e ) { // @codeCoverageIgnoreStart $ em -> close ( ) ; $ em -> getConnection ( ) -> rollback ( ) ; throw $ e ; // @codeCoverageIgnoreEnd } // endTransaction }
moves node as last child of the given node

@param NodeWrapper $node
moves node as last child of the given node