How to pass single element of parameter, declared as array?

Viewed 624

I have in config.yml:

parameters:
    aaa:
        bbb: 'Example'

If I pass this in service:

AppBundle\Service\Service:
    arguments:
        $bbb: '%aaa%'

Then this is working well and I have array, but if I pass:

AppBundle\Service\Service:
    arguments:
        $bbb: '%aaa.bbb%'

Then I have error:

The service "AppBundle\Service\Service" has a dependency on a non- existent parameter "aaa.bbb". You cannot access nested array items, do you want to inject "aaa" instead?

Is possible to pass only one value?

1 Answers

You have to have parameters like this:

parameters:
    aaa.bbb: 'Example'

with purpose to re-use like:

AppBundle\Service\Service:
    arguments:
        $bbb: '%aaa.bbb%'

Otherwise, you have to pass whole array, you can't pass single element from array.

Related