How to access arrays in symfony config files?
Can symfony2 only handle flat parameters?
Let's say we have:
services:
manager:
class: blabla
arguments: [%app.vat%]
and in app.yml:
parameters:
app.vat: 24.5
it works but
parameters:
app:
vat: 24.5
does not work. Is there a special syntax for accessing arrays, or is this not possible?
+3
source to share
1 answer
It really is possible. You can access the values ββfrom your example in your code like this:
$config = $this->get('service_container')->getParameter('app.vat');
If that still doesn't work, you should try to rename "application" to something else (eg "application"). Symfony stores the name "application" in many places and treats it in a special way.
0
source to share