【发布时间】:2019-04-11 20:11:08
【问题描述】:
在 Symfony 中,我尝试将 YAML 块从 parameters.yml 合并到 config.yml。我的问题是如何在 Symfony 3.4 中存储一些配置,然后插入到我的配置文件中。现在我得到一个错误:
在 Parser.php 第 290 行:
参考“'%insurance%'”在第 188 行不存在(靠近“
parameters.yml
parameters:
Insurance: &insurance
list:
title: '<strong>Ubezpieczenia</strong>'
sort: ['sequence', 'ASC']
fields:
- { property: 'sequence', label: 'Kolejność'}
- { property: 'title', label: 'Tytuł'}
- { property: 'description', label: 'Opis'}
form:
fields:
- { property: 'title', type: 'text', label: 'Tytuł'}
- { property: 'description', type: 'ckeditor', label: 'Opis',
type_options: { config_name: 'simple_config' }}
- { property: 'sequence', type: 'integer', label: 'Kolejność'}
config.yml
imports:
- { resource: parameters.yml }
easy_admin:
[...]
entities:
[...]
MotorInsurance:
class: AppBundle\Entity\MotorInsurance
label: menu.motorInsurance
<<: *'%insurance%'
[...] 有不相关的配置
我在调用Inusrance 阻止时是否做错了什么?
【问题讨论】:
-
尝试在 config.yml 文件中将
<<: *'%insurance%'更改为<<: *insurance(引号和百分号已删除)。 -
我以前试过这个,但没用。我认为@xabbuh 是对的,但他的解决方案在 Symfony 中不起作用,因为它解析
config.yml仅用于扩展