src/Model/SortableHelper.php
public function prependEntities (array $prepended, array $where = []) : void
    {
        $all = $this->getAllEntities($where);
        $index = 0;

        // first prepend
        foreach ($prepended as $prependedEntity)
        {
            $prependedEntity->setSortOrder($index);
            ++$index;
        }

        // then sort the rest
        foreach ($all as $entity)
        {
            if (\in_array($entity, $prepended, true))
            {
                continue;
            }

            $entity->setSortOrder($index);
            ++$index;
        }
    }
public function prependEntities (array $prepended, array $where = []) : void
    {
        $all = $this->getAllEntities($where);
        $index = 0;

        // first prepend
        foreach ($prepended as $prependedEntity)
        {
            $prependedEntity->setSortOrder($index);
            ++$index;
        }

        // then sort the rest
        foreach ($all as $entity)
        {
            if (\in_array($entity, $prepended, true))
            {
                continue;
            }

            $entity->setSortOrder($index);
            ++$index;
        }
    }
public function prependEntities ( array $ prepended , array $ where = [ ] ) : void { $ all = $ this -> getAllEntities ( $ where ) ; $ index = 0 ; // first prepend foreach ( $ prepended as $ prependedEntity ) { $ prependedEntity -> setSortOrder ( $ index ) ; ++ $ index ; } // then sort the rest foreach ( $ all as $ entity ) { if ( \ in_array ( $ entity , $ prepended , true ) ) { continue ; } $ entity -> setSortOrder ( $ index ) ; ++ $ index ; } }
Prepends the given entities to the list.

@param SortableEntityInterface[] $prepended
@param array                     $where
Prepends the given entities to the list .