[英]Pass in part of a parameter into security.yml - Symfony2
I have this in parameters.yml 我在parameters.yml中有这个
parameters:
various_info:
setting_1:
test: true
I want to pass in 'various_info.setting_1' into a service, but can only seem to get it working if I pass in the whole 'various_info' parameter. 我想将'various_info.setting_1'传递到服务中,但是如果我传递整个'various_info'参数,似乎只能使它正常工作。
In services.yml this would work 在services.yml这将工作
a.random.service:
class: etc..
arguments:
- @another_service
- %another_param%
- %various_info%
...but I want to just pass in the part required, and neither of these will work ...但是我只想传递所需的部分,但这些都不起作用
arguments:
- %various_info.setting_1%
arguments:
- [%various_info.setting_1%]
Is it possible? 可能吗? It would be clearner and a better practice to only pass the part required I think.
仅通过我认为需要的部分,这将是更清晰和更好的做法。
This is possible. 这个有可能。 The security.yml gets included at the beginning of config.yml, which also includes the parameters.yml.
security.yml被包含在config.yml的开头,该文件还包含parameters.yml。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.