I have followed this: http://sonata-project.org/bundles/admin/master/doc/cookbook/recipe_sortable_listing.html
And when click up or down button then show me :
The controller for URI "/admin/xxx/frontend/abc/1/move/down" is not callable.
I don't know Why ?
This is my code:
Config.yml
sonata.admin.abc:
class: XXX\AdminBundle\Admin\ABCAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "Home", label: "Abc" }
arguments:
- ~
- XXX\FrontendBundle\Entity\ABC
- XXXAdminBundle:ABCAdmin
- PixSortableBehaviorBundle:SortableAdmin
calls:
- [ setContainer, [ @service_container ] ]
- [ setPositionService, [@pix_sortable_behavior.position]]
ABCAdmin.php
class ABCAdmin extends Admin
{
public $last_position = 0;
private $container;
private $positionService;
public function setContainer(\Symfony\Component\DependencyInjection\ContainerInterface $container)
{
$this->container = $container;
}
public function setPositionService(\Pix\SortableBehaviorBundle\Services\PositionHandler $positionHandler)
{
$this->positionService = $positionHandler;
}
protected $datagridValues = array(
'_page' => 1,
'_sort_order' => 'ASC',
'_sort_by' => 'position',
);
protected function configureRoutes(RouteCollection $collection) {
$collection
->add('move', $this->getRouterIdParameter() . '/move/{position}');
}
public function prePersist($page) {
}
protected function configureListFields(ListMapper $listMapper)
{
$this->last_position = $this->positionService->getLastPosition($this->getRoot()->getClass());
$listMapper
->add('_action', 'actions', array(
'actions' => array(
'move' => array('template' => 'XXXAdminBundle:Sortable:_sort.html.twig'),
)));
}
}
Thanks !!