0

I'll explain with a simple example.this is the services.yml file:

parameters:
    foo.array:
        bar: barstring
        baz: bazstring

services:
    bar_service:
        class: barclass
        arguments:
            - # i want to give foo.array['bar'] (barstring) here as an argument

how do i do that?

2
  • I've tried %foo.array.bar% and %foo.array["bar"]% but none of them work. Commented Jul 26, 2014 at 5:30
  • I'm not entirely sure that you can. You could set barstring as it's own parameter and then reference that as bar: %barstring% to stop repetition and also keep the array but I'm not sure the other way is possible...... In fact this has been covered, see stackoverflow.com/a/19920871/1791606 Commented Jul 26, 2014 at 9:34

1 Answer 1

0

You cannot do this. The parameter must be at first level.

in your example, you could do:

parameters:
    foo.array.bar: barstring
    foo.array.baz: bazstring

services:
    bar_service:
        class: barclass
        arguments:
            - %foo.array.bar%

Duplicate of this stackoverflow question

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.