custom action in SonataAdminBundle custom action in SonataAdminBundle php php

custom action in SonataAdminBundle


When you are creating service for EntityAdmin class the third argument is the controller name. You can create a class that extends CRUDController and set it in service. e.g

The controller,

//Vendor\YourBundle\Controller\EntityAdminController.phpclass EntityAdminController extends CRUDController{    public function ispremiumAction()    {        //process    }}

In services.yml,

entity.admin.service:  class: FQCN\Of\EntityAdmin  tags:    - { name: sonata.admin, manager_type: orm, group: your_group, label: Label }  arguments: [null, FQCN\Of\Entity, VendorYourBundle:EntityAdmin]