Ben*_*Ben 4 symfony symfony-console symfony-flex symfony4
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).
Since Symfony 4+, this discovery doesn't work as expected.
Try this:
composer create-project symfony/skeleton test-maxmind-sf4
cd test-maxmind-sf4
composer req cravler/maxmind-geoip-bundle dev-master
php bin/console list
Run Code Online (Sandbox Code Playgroud)
You will notice that:
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
Run Code Online (Sandbox Code Playgroud)
What's missing there?
Thank you,
Ben
从这里的UPGRADE FROM to 4.0指南:
不再支持依赖基于约定的命令发现。请改用基于 PSR-4 的服务发现。
前:
Run Code Online (Sandbox Code Playgroud)# app/config/services.yml services: # ... # implicit registration of all commands in the `Command` folder后:
Run Code Online (Sandbox Code Playgroud)# app/config/services.yml services: # ... # explicit commands registration AppBundle\Command\: resource: '../../src/AppBundle/Command/*' tags: ['console.command']
希望这有帮助
| 归档时间: |
|
| 查看次数: |
1988 次 |
| 最近记录: |