Symfony 3.4
I have a parameter that looks like this:
parameters.yml
:
paramters:
some_configuration:
param1: value1
param2: value2
I want to pass a value within my some_configuration
parameter directly to a service, rather that some_configuration
itself. Something like this:
services.yml
:
services:
AppBundle\Service\MyService:
arguments:
$serviceparam: '%some_configuration.param2%'
Is this possible somehow?
Above Symfony 2.7.3
In all the Symfony config files I've seen, the entries under 'parameters:' have always been fully qualified.
I don't fully understand why this is but it may help you to write the entries in your
parameters.yml
like this:parameters.yml
:To use parameter array values in
service.yaml
you can use it as a normal parameter (like what you've written!):service.yaml
In symfony 2.7.3:
It can be accomplished the following way:
It works for symfony 2.7.3
More info about the expression language can be found in the symfony doc