如何从奏鸣曲管理员创建与实体无关的自定义操作 [英] How to create a custom action not related to entity from sonata admin

查看:25
本文介绍了如何从奏鸣曲管理员创建与实体无关的自定义操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要添加一个操作来清除奏鸣曲管理中的 symfony2 缓存,例如在更新 JMS 翻译时将使用该缓存.我想知道如何在 sonata admin 中创建与实体无关的自定义操作,以及如何在管理员单击相应的自定义链接时从中执行清除缓存命令.

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.

推荐答案

你可以用非常简单的 Symfony 方式创建一个动作 - 创建一个路由,为这个路由创建一个通用控制器.或者以 Symfony 提供的任何其他方式调用该操作.

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 管理包只是使用它的 CRUD 控制器扩展您的应用程序,您可以使用它.但任何其他以正常方式创建的控制器也能正常工作.

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.

这篇关于如何从奏鸣曲管理员创建与实体无关的自定义操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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