services.yaml
当我从Symfony 3.4升级到Symfony 4并使用浏览器显示系统时,出现以下错误。当我把它提高到4时,我取消了这两束,把它们移到了src/
。当然,没有相同的service.php。
我也做了composer dump-autoload
。还有什么需要考虑的吗?
错误代码
Compile Error: Cannot declare class AppModelServiceEcItemTagService, because the name is already in use
services.yaml
App:
resource: '../src/*'
exclude: '../src/{Entity, Migrations, Tests}'
common.ecItemTagService:
class: AppModelServiceEcItemTagService
arguments: ['@service_container']
PHP 7.3
Symfony4.0.9
删除这一行,然后您可以直接使用EcItemTagService
与他的完整命名空间
common.ecItemTagService:
class: AppModelServiceEcItemTagService
arguments: ['@service_container']
出现错误是因为你对'src'内部的所有服务使用了自动装配