my parameters.yml file has:
parameters:
title:
subtitle: value
i want to pass the value
to a service in config.yml
my_service:
class: the_class
arguments: [ %title.subtitle%] //didn't work
arguments: [ %title['subtitle']%] //didn't work
how can i do this?
The %
notation doesn't work but it can be accomplished the following way:
my_service:
class: the_class
arguments: ["@=container.getParameter('title')['subtitle']"]
It works at least for symfony 2.7.3
More info about the expression language can be found in the cookbook: http://symfony.com/doc/current/book/service_container.html#using-the-expression-language
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments