Sonata admin 自定义列表动作调用错误方法
Sonata admin custom list action calls wrong method
顾名思义,sonata admin自定义列表操作调用错误方法
有两个管理员类
- AppleIdAdmin
- iTunesGiftCardAdmin
还有另外两个控制器:
- 打印控制器
- 短信控制器
每个管理员 类 都能够使用在每个控制器中创建的两种不同方法发送短信和打印对象,
- smsAppleIdAction
- smsITunesAction
- printAppleIdAction
- 打印iTunesAction
这是我的 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
奇怪的是,当通过短信发送 apple 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 文件都正常,它们调用了正确的操作。
好吧,解决方案是为每个管理员使用一个控制器,并在该控制器中使用短信和打印方法。
不知道为什么,但它可以帮助某人......总有一天 :)
所以现在,我有 AppleIdContoller
、ITunesContoller
,并且每个控制器都包含相应的 smsAction
和 printAction
顾名思义,sonata admin自定义列表操作调用错误方法
有两个管理员类
- AppleIdAdmin
- iTunesGiftCardAdmin
还有另外两个控制器:
- 打印控制器
- 短信控制器
每个管理员 类 都能够使用在每个控制器中创建的两种不同方法发送短信和打印对象,
- smsAppleIdAction
- smsITunesAction
- printAppleIdAction
- 打印iTunesAction
这是我的 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
奇怪的是,当通过短信发送 apple 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 文件都正常,它们调用了正确的操作。
好吧,解决方案是为每个管理员使用一个控制器,并在该控制器中使用短信和打印方法。 不知道为什么,但它可以帮助某人......总有一天 :)
所以现在,我有 AppleIdContoller
、ITunesContoller
,并且每个控制器都包含相应的 smsAction
和 printAction