How to create a custom action not related to entity from sonata admin

我们两清 提交于 2020-01-07 02:57:42

问题


I need to add an action to clear symfony2 cache in sonata admin which will be used for example when JMS translations are updated. I would like to know how to create a custom action not related to entity in sonata admin and how to execute clear cache command from it when the admin will click on the corresponding custom link.


回答1:


You may create an action in very straight-forward Symfony way - create a route, make a common controller for this route. Or call the action in any other way Symfony offers.

Sonata admin bundle just extend your application with it's CRUD controller, which you can use. But any other controllers created in normal way are working as well.



来源:https://stackoverflow.com/questions/38221948/how-to-create-a-custom-action-not-related-to-entity-from-sonata-admin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!