public function insertAsPrevSiblingOf(NodeWrapper $node)
    {
        if($node == $this)
        {
            throw new \InvalidArgumentException('Cannot insert node as a sibling of itself');
        }

        $em = $this->getManager()->getEntityManager();
        $newLeft = $node->getLeftValue();
        $newRight = $node->getLeftValue() + 1;
        $newRoot = $this->hasManyRoots() ? $node->getRootValue() : null;

        // beginTransaction
        $em->getConnection()->beginTransaction();
        try
        {
            $this->shiftRLRange($newLeft, 0, 2, $newRoot);
            $this->insertNode($newLeft, $newRight, $newRoot);

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

        $em = $this->getManager()->getEntityManager();
        $newLeft = $node->getLeftValue();
        $newRight = $node->getLeftValue() + 1;
        $newRoot = $this->hasManyRoots() ? $node->getRootValue() : null;

        // beginTransaction
        $em->getConnection()->beginTransaction();
        try
        {
            $this->shiftRLRange($newLeft, 0, 2, $newRoot);
            $this->insertNode($newLeft, $newRight, $newRoot);

            $em->flush();
            $em->getConnection()->commit();
        }
        catch (\Exception $e)
        {
            // @codeCoverageIgnoreStart
            $em->close();
            $em->getConnection()->rollback();
            throw $e;
            // @codeCoverageIgnoreEnd
        }
        // endTransaction
    }
public function insertAsPrevSiblingOf ( NodeWrapper $ node ) { if ( $ node == $ this ) { throw new \ InvalidArgumentException ( 'Cannot insert node as a sibling of itself' ) ; } $ em = $ this -> getManager ( ) -> getEntityManager ( ) ; $ newLeft = $ node -> getLeftValue ( ) ; $ newRight = $ node -> getLeftValue ( ) + 1 ; $ newRoot = $ this -> hasManyRoots ( ) ? $ node -> getRootValue ( ) : null ; // beginTransaction $ em -> getConnection ( ) -> beginTransaction ( ) ; try { $ this -> shiftRLRange ( $ newLeft , 0 , 2 , $ newRoot ) ; $ this -> insertNode ( $ newLeft , $ newRight , $ newRoot ) ; $ em -> flush ( ) ; $ em -> getConnection ( ) -> commit ( ) ; } catch ( \ Exception $ e ) { // @codeCoverageIgnoreStart $ em -> close ( ) ; $ em -> getConnection ( ) -> rollback ( ) ; throw $ e ; // @codeCoverageIgnoreEnd } // endTransaction }
inserts node as previous sibling of given node

@param NodeWrapper $node
inserts node as previous sibling of given node