src/Kunstmaan/AdminListBundle/Controller/AdminListController.php
protected function setSortWeightOnNewItem(AbstractAdminListConfigurator $configurator, $item)
    {
        if ($configurator instanceof SortableInterface) {
            $repo = $this->getEntityManager()->getRepository($configurator->getRepositoryName());
            $sort = $configurator->getSortableField();
            $weight = $this->getMaxSortableField($repo, $sort);
            $setter = 'set'.ucfirst($sort);
            $item->$setter($weight + 1);
        }

        return $item;
    }
protected function setSortWeightOnNewItem(AbstractAdminListConfigurator $configurator, $item)
    {
        if ($configurator instanceof SortableInterface) {
            $repo = $this->getEntityManager()->getRepository($configurator->getRepositoryName());
            $sort = $configurator->getSortableField();
            $weight = $this->getMaxSortableField($repo, $sort);
            $setter = 'set'.ucfirst($sort);
            $item->$setter($weight + 1);
        }

        return $item;
    }
protected function setSortWeightOnNewItem ( AbstractAdminListConfigurator $ configurator , $ item ) { if ( $ configurator instanceof SortableInterface ) { $ repo = $ this -> getEntityManager ( ) -> getRepository ( $ configurator -> getRepositoryName ( ) ) ; $ sort = $ configurator -> getSortableField ( ) ; $ weight = $ this -> getMaxSortableField ( $ repo , $ sort ) ; $ setter = 'set' . ucfirst ( $ sort ) ; $ item -> $ setter ( $ weight + 1 ) ; } return $ item ; }
Sets the sort weight on a new item. Can be overridden if a non-default sorting implementation is being used.

@param AbstractAdminListConfigurator $configurator The adminlist configurator
@param $item

@return mixed
Sets the sort weight on a new item . Can be overridden if a non - default sorting implementation is being used .