dtcu5885 2014-09-14 20:37
浏览 36

依赖包中的Symfony2控制台命令

I've developed a bundle, which is not a standalone Symfony2 application, but merely a layer between the framework and the final application, taking care of some common taks.

When I create a Bundle/Command/SomeCommand.php with an appropriate class within, the command isn't available in Symfony. When I, however, copy the same command to the "final" bundle, which extends upon classes from the "parent" bundle, the command is available there.

I suspect the bundle has to be registered somewhere in Kernel or such thing, but I'm struggling to find any information about that, so any idea would be greatly appreciated!

Thanks!

  • 写回答

1条回答 默认 最新

  • doushan7997 2014-09-14 21:00
    关注

    When Bundle is registered as a bundle, the command should be available when it's placed in Bundle/Command/SomeCommand.php (note the singular Command versus your plural form).

    You can also tag it as a service since Symfony 2.4, you can register commands as services using the console.command tag.

    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)