16

是否有一种简单的方法可以为给定的管理类禁用某些 CRUD 操作?例如,我只想要通过前端添加的用户列表,而没有手动添加它们的选项。

4

1 回答 1

48

In your admin class :

protected function configureRoutes(RouteCollection $collection)
{
    // to remove a single route
    $collection->remove('delete');
    // OR remove all route except named ones
    $collection->clearExcept(array('list', 'show'));
}

Also use routeCollection at top of admin class

use Sonata\AdminBundle\Route\RouteCollection;

Docs : http://sonata-project.org/bundles/admin/master/doc/reference/routing.html#removing-a-single-route

于 2013-08-17T14:53:57.660 回答