custom action in SonataAdminBundle

后端 未结 1 709
一向
一向 2020-12-25 08:47

On this page I found how to add route for my custom action.

protected function configureRoutes(RouteCollection $collection) {
    $collection->add(\'ispr         


        
相关标签:
1条回答
  • 2020-12-25 09:39

    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.php
    
    class 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]
    
    0 讨论(0)
提交回复
热议问题