src/Franzose/ClosureTable/Models/Entity.php
protected function reorderSiblings($parentIdChanged = false)
    {
        list($range, $action) = $this->setupReordering($parentIdChanged);

        $positionColumn = $this->getPositionColumn();

        // As the method called twice (before moving and after moving),
        // first we gather "old" siblings by the old parent id value of the model.
        if ($parentIdChanged === true) {
            $query = $this->siblings(false, $this->old_parent_id);
        } else {
            $query = $this->siblings();
        }

        if ($action) {
            $query->buildWherePosition($positionColumn, $range)
                ->where($this->getKeyName(), '<>', $this->getKey())
                ->$action($positionColumn);
        }
    }
protected function reorderSiblings($parentIdChanged = false)
    {
        list($range, $action) = $this->setupReordering($parentIdChanged);

        $positionColumn = $this->getPositionColumn();

        // As the method called twice (before moving and after moving),
        // first we gather "old" siblings by the old parent id value of the model.
        if ($parentIdChanged === true) {
            $query = $this->siblings(false, $this->old_parent_id);
        } else {
            $query = $this->siblings();
        }

        if ($action) {
            $query->buildWherePosition($positionColumn, $range)
                ->where($this->getKeyName(), '<>', $this->getKey())
                ->$action($positionColumn);
        }
    }
protected function reorderSiblings ( $ parentIdChanged = false ) { list ( $ range , $ action ) = $ this -> setupReordering ( $ parentIdChanged ) ; $ positionColumn = $ this -> getPositionColumn ( ) ; // As the method called twice (before moving and after moving), // first we gather "old" siblings by the old parent id value of the model. if ( $ parentIdChanged === true ) { $ query = $ this -> siblings ( false , $ this -> old_parent_id ) ; } else { $ query = $ this -> siblings ( ) ; } if ( $ action ) { $ query -> buildWherePosition ( $ positionColumn , $ range ) -> where ( $ this -> getKeyName ( ) , '<>' , $ this -> getKey ( ) ) -> $ action ( $ positionColumn ) ; } }
Reorders model's siblings when one is moved to another position or ancestor.

@param bool $parentIdChanged
@return void
Reorders model s siblings when one is moved to another position or ancestor .