Symfony 4-不再自动发现3rd-party捆绑包命令 [英] Symfony 4 - 3rd-party bundle commands are no longer automatically discovered
本文介绍了Symfony 4-不再自动发现3rd-party捆绑包命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
根据文档,命令类必须扩展Command或ContainerAwareCommand以自动发现并注册(当然,前提是其捆绑包已在内核中注册).
According to the documentation, a command class must extend Command or ContainerAwareCommand to be automatically discovered and registered (provided its bundle is registered in the Kernel, of course).
自Symfony 4+起,此发现无法按预期进行.
Since Symfony 4+, this discovery doesn't work as expected.
尝试一下:
composer create-project symfony/skeleton test-maxmind-sf4
cd test-maxmind-sf4
composer req cravler/maxmind-geoip-bundle dev-master
php bin/console list
您会注意到:
- cravler:maxmind:geoip-update未注册("cravler"命名空间下没有任何内容
- Cravler \ MaxMindGeoIpBundle \ Command \ UpdateDatabaseCommand扩展了ContainerAwareCommand
- 在所有环境下,config.bundles.php中都会注册Bundle Cravler \ MaxMindGeoIpBundle \ CravlerMaxMindGeoIpBundle(自动生成的配方)
现在,当我对Symfony 3进行完全相同的操作时,一切正常.
Now when I do exactly the same thing with Symfony 3, everything works properly.
composer create-project symfony/skeleton test-maxmind-sf3 ^3.0
cd test-maxmind-sf3
composer req cravler/maxmind-geoip-bundle dev-master
php bin/console list
那里缺少什么?
谢谢
本
推荐答案
查看全文