几个月前我已经将我的 symfony projet 版本从 3.3 升级到 3.4,一切都醒了,但我最近尝试添加一个事件监听器,然后我得到了那个错误
The configuration key "public" cannot be used to define a default value in "/home/pc-dev/Labs/Projets-jebuy/je-buy.com/app/config/services.yml". Allowed keys are "private", "tags", "autowire", "autoconfigure", "bind" in /home
/pc-dev/Labs/Projets-jebuy/je-buy.com/app/config/services.yml (which is being imported from "/home/pc-dev/Labs/Projets-jebuy/je-buy.com/app/config/config.yml").
显然没有什么我从这里编辑了默认的 service.yml 文件
# default configuration for services in *this* file
_defaults:
# automatically injects dependencies in your services
autowire: true
# automatically registers your services as commands, event subscribers, etc.
autoconfigure: true
# this means you cannot fetch services directly from the container via $container->get()
# if you need to do this, you can override this setting on individual services
public: false
twig.extension:
class: AppBundle\Twig\Extension\MenuExtension
arguments:
- '@doctrine'
tags:
- {name : twig.extension }
# service.extension:
# class: AdminBundle\DependencyInjection\AdminExtension
# arguments: []
# tags: []
对此(因为在 symfony 3.4 或 4 中,所有服务默认都是私有的)
services:
# default configuration for services in *this* file
_defaults:
# automatically injects dependencies in your services
autowire: true
# automatically registers your services as commands, event subscribers, etc.
autoconfigure: true
# this means you cannot fetch services directly from the container via $container->get()
# if you need to do this, you can override this setting on individual services
private: true
twig.extension:
class: AppBundle\Twig\Extension\MenuExtension
arguments:
- '@doctrine'
tags:
- {name : twig.extension }
# service.extension:
# class: AdminBundle\DependencyInjection\AdminExtension
# arguments: []
# tags: []
但是当我尝试运行服务器时,我现在遇到了这个错误
The service "templating.loader.cache" has a dependency on a non-existent service "templating.loader.wrapped".
而且我现在不知道如何解决它,那个 template.loder.wrapped 服务在哪里。