禁用奏鸣曲管理包 CRUD 中的操作 [英] disable action in sonata admin bundle CRUD

查看:24
本文介绍了禁用奏鸣曲管理包 CRUD 中的操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

IS there a simple way to disable some CRUD actions for given admin class? E.g. I just want a list of users added via front-end without the option to manually add them.

推荐答案

在您的管理类中:

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'));
}

也在管理类的顶部使用 routeCollection

Also use routeCollection at top of admin class

use Sonata\AdminBundle\Route\RouteCollection;

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

这篇关于禁用奏鸣曲管理包 CRUD 中的操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆