src/Controller/SortingManager.php
protected function scanToDesiredPosition()
    {
        // Enforce proper sorting now.
        $this->marker   = null;
        $this->position = 0;
        $ids            = $this->getModelIds();
        // If no previous model, insert at beginning.
        if (null === $this->previousModel) {
            if ($this->siblingsCopy->length()) {
                $this->marker = $this->siblingsCopy->shift();
            }

            return;
        }

        if ($this->siblingsCopy->length()) {
            // Search for "previous" sibling.
            do {
                $this->marker = $this->siblingsCopy->shift();

                if (\in_array($this->marker->getId(), $ids)) {
                    continue;
                }

                if ($this->marker) {
                    $this->position = $this->marker->getProperty($this->getSortingProperty());
                }
            } while ($this->marker && $this->marker->getId() !== $this->getPreviousModel()->getId());

            // Remember the "next" sibling.
            if ($this->marker) {
                $this->marker = $this->siblingsCopy->shift();
            }
        }
    }
protected function scanToDesiredPosition()
    {
        // Enforce proper sorting now.
        $this->marker   = null;
        $this->position = 0;
        $ids            = $this->getModelIds();
        // If no previous model, insert at beginning.
        if (null === $this->previousModel) {
            if ($this->siblingsCopy->length()) {
                $this->marker = $this->siblingsCopy->shift();
            }

            return;
        }

        if ($this->siblingsCopy->length()) {
            // Search for "previous" sibling.
            do {
                $this->marker = $this->siblingsCopy->shift();

                if (\in_array($this->marker->getId(), $ids)) {
                    continue;
                }

                if ($this->marker) {
                    $this->position = $this->marker->getProperty($this->getSortingProperty());
                }
            } while ($this->marker && $this->marker->getId() !== $this->getPreviousModel()->getId());

            // Remember the "next" sibling.
            if ($this->marker) {
                $this->marker = $this->siblingsCopy->shift();
            }
        }
    }
protected function scanToDesiredPosition ( ) { // Enforce proper sorting now. $ this -> marker = null ; $ this -> position = 0 ; $ ids = $ this -> getModelIds ( ) ; // If no previous model, insert at beginning. if ( null === $ this -> previousModel ) { if ( $ this -> siblingsCopy -> length ( ) ) { $ this -> marker = $ this -> siblingsCopy -> shift ( ) ; } return ; } if ( $ this -> siblingsCopy -> length ( ) ) { // Search for "previous" sibling. do { $ this -> marker = $ this -> siblingsCopy -> shift ( ) ; if ( \ in_array ( $ this -> marker -> getId ( ) , $ ids ) ) { continue ; } if ( $ this -> marker ) { $ this -> position = $ this -> marker -> getProperty ( $ this -> getSortingProperty ( ) ) ; } } while ( $ this -> marker && $ this -> marker -> getId ( ) !== $ this -> getPreviousModel ( ) -> getId ( ) ) ; // Remember the "next" sibling. if ( $ this -> marker ) { $ this -> marker = $ this -> siblingsCopy -> shift ( ) ; } } }
Scan through the sibling list to the position we want to insert at.

@return void
Scan through the sibling list to the position we want to insert at .