In Symfony 2 i have a yml file like this:
my_application:
application:
name: "Hello World"
version: { major: 1, minor: 0, build: 4, stage: BETA }
If i want to fetch Hello World -for example- i use this command:
echo $container->getParameter('my_application.application.name');
Prints:
"Hello World"
Now, what if i want to get the whole application? Within inside of arrays?
print_r($container->getParameter('my_application.application'));
Gives me an error:
ParameterNotFoundException: You have requested a non-existent parameter "my_application.application".
But it exist. All i want to do is fetch the whole node. As array.
Is it possible, if yes, how? If no, why again?
– Obviously, symfony tells me that this is not a single parameter but a bag (maybe) but how can i fetch it as array? –
yes – because it maps config into flat structure. You can see exactly how data is stored in that way: