简体   繁体   English

Symfony 3.4控制台命令定义无法识别

[英]Symfony 3.4 console command definition not being recognized

I'm upgrading a existing Symfony 3.3 application to Symfony 3.4. 我正在将现有的Symfony 3.3应用程序升级到Symfony 3.4。

I'm getting a console command auto-registration warning in spite of the fact that I've defined the command in the bundle's services.yml file. 我收到了一个控制台命令自动注册警告,尽管我已经在bundle的services.yml文件中定义了该命令。 The warning: 警告:

[2017-12-14 12:22:19] php.INFO: User Deprecated: Auto-registration of the command "Dplh\\DplhIssuesBundle\\Command\\IssuesReportCommand" is deprecated since Symfony 3.4 and won't be supported in 4.0. [2017-12-14 12:22:19] php.INFO:用户不推荐使用:自从Symfony 3.4开始,自动注册命令“Dplh \\ DplhIssuesBundle \\ Command \\ IssuesReportCommand”并且4.0不支持。 Use PSR-4 based service discovery instead. 请改用基于PSR-4的服务发现。

The entry in Dplh/DplhIssuesBundle/Resources/config/services.yml: Dplh / DplhIssuesBundle / Resources / config / services.yml中的条目:

services:
  Dplh\DplhIssuesBundle\Command\IssuesReportCommand:
    public:   true
    tags:     ['console.command']
    calls:
      - [ saveDependencies, [ '@logger' ]]

I am positive that the services.yml file is being processed by Symfony because if I intentionally create a syntax error in it, Symfony reports that the file contains invalid YAML. 我很肯定symfony正在处理services.yml文件,因为如果我故意在其中创建语法错误,Symfony会报告该文件包含无效的YAML。

Finally found it. 终于找到了。 There was a reference to the Dplh\\DplhIssuesBundle\\Command\\IssuesReportCommand class in another bundle's services.yml file (copy/paste error, I'm sure). 在另一个bundle的services.yml文件中引用了Dplh \\ DplhIssuesBundle \\ Command \\ IssuesReportCommand类(复制/粘贴错误,我很确定)。

Removing that reference removed the error. 删除该引用删除了错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM