Sonata管理员自定义列表操作调用错误的方法

时间:2016-03-15 22:30:02

标签: php symfony sonata-admin symfony-sonata sonata

顾名思义,奏鸣曲管理员自定义列表操作调用错误的方法。

有两个管理类

  • AppleIdAdmin
  • ITunesGiftCardAdmin

还有另外两个控制器:

  • PrintController
  • SMSController

每个管理类都能够发送短信并使用在每个控制器中创建的两种不同方法打印对象,

  • smsAppleIdAction
  • smsITunesAction
  • printAppleIdAction
  • printITunesAction

这是我的service.yml

services:
    administration_product_product.admin.apple_id:
        class: Administration\Product\ProductBundle\Admin\AppleIdAdmin
        arguments: [~, Administration\Product\ProductBundle\Entity\AppleId, SonataAdminBundle:CRUD]
        tags:
            - {name: sonata.admin, manager_type: orm, group: Gift Cards, label: Apple ID}

    administration_product_product.admin.sms_appleid:
        class: Administration\Product\ProductBundle\Admin\AppleIdAdmin
        tags:
            - { name: sonata.admin, manager_type: orm, group: admin, label: Apple ID }
        arguments:
            - null
            - Administration\Product\ProductBundle\Entity\AppleId
            - AdministrationProductProductBundle:SMS

    administration_product_product.admin.print_appleid:
        class: Administration\Product\ProductBundle\Admin\AppleIdAdmin
        tags:
            - { name: sonata.admin, manager_type: orm, group: admin, label: Apple ID }
        arguments:
            - null
            - Administration\Product\ProductBundle\Entity\AppleId
            - AdministrationProductProductBundle:Print

    administration_product_product.admin.i_tunes_gift_card:
        class: Administration\Product\ProductBundle\Admin\ITunesGiftCardAdmin
        arguments: [~, Administration\Product\ProductBundle\Entity\ITunesGiftCard, SonataAdminBundle:CRUD]
        tags:
            - { name: sonata.admin, manager_type: orm, group: Gift Cards, label: iTunes Gift Card }

    administration_product_product.admin.print_itunes:
        class: Administration\Product\ProductBundle\Admin\ITunesGiftCardAdmin
        tags:
            - { name: sonata.admin, manager_type: orm, group: admin, label: iTunes Gift Card }
        arguments:
            - null
            - Administration\Product\ProductBundle\Entity\ITunesGiftCard
            - AdministrationProductProductBundle:Print
administration_product_product.admin.sms_itunes:
    class: Administration\Product\ProductBundle\Admin\ITunesGiftCardAdmin
    tags:
        - { name: sonata.admin, manager_type: orm, group: admin, label: iTunes Gift Card }
    arguments:
        - null
        - Administration\Product\ProductBundle\Entity\ITunesGiftCard
        - AdministrationProductProductBundle:SMS

奇怪的是,当通过短信发送苹果ID时(打印没问题!)我收到了这个错误:

Controller "Administration\Product\ProductBundle\Controller\PrintController::smsAppleIdAction" for URI "/admin/product/product/appleid/smsAppleId" is not callable.

当打印iTunes卡时(短信没问题!),此错误显示:

Controller "Administration\Product\ProductBundle\Controller\SMSController::printITunesAction" for URI "/admin/product/product/itunesgiftcard/printITunes" is not callable.

此外,所有list_action twig文件都可以,他们会调用正确的操作。

1 个答案:

答案 0 :(得分:0)

嗯,解决方案是为每个管理员使用一个控制器,并在此控制器中使用短信和打印方法。 不知道为什么,但它可以帮助某人......有一天:)

现在,我有AppleIdContollerITunesContoller,每个控制器都包含相应的smsActionprintAction