29461

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

Question:

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.

Answer1:

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.

Recommend

  • using localization in cakephp
  • The value of my function is undefined
  • How to use get all NSLocalization using genstrings while preserved current translations
  • Symfony2 - Doctrine - no changeset in post update
  • Doctrine/Symfony entity generator and generating entity from one table
  • SAVE attribute needed for Fortran variables when only the C_LOC address is returned to a C program?
  • Why cepheus don't send int without quotes to orion?
  • GAE: Way to get reference to an HttpSession from its ID?
  • I18n locale disregarding fallbacks
  • Security issues with PHP's Readfile method
  • Force show.bind execution
  • How to revert to previous XCode version?
  • How can I enlarge video fullscreen without the affected interface project in as3?
  • Assign variable to the value in HTML
  • onBackPressed() not being executed
  • How to use carriage return with multiple line?
  • NHibernate Validation Localization with S#arp Architecture
  • Jenkins: How To Build multiple projects from a TFS repository?
  • Why ng-show works with ng-repeat but ng-if doesn't? [duplicate]
  • How do I fake an specific browser client when using Java's Net library?
  • Bug in WPF DataGrid
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Perl system calls when running as another user using sudo
  • Redux, normalised entities and lodash merge
  • Adding custom controls to a full screen movie
  • jquery mobile loadPage not working
  • How to get next/previous record number?
  • Delete MySQLi record without showing the id in the URL
  • Apache 2.4 - remove | delete | uninstall
  • Confusion with PayPal's monthly billing cycle
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Data Validation Drop Down Box Arrow Disappearing
  • Comma separated Values
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • How do you join a server to an Active Directory (domain)?
  • how does django model after text[] in postgresql [duplicate]
  • Cant find why the layout is getting smaller
  • Programmatically clearing map cache