0

I could not find an answer to my question. I want to get an paramter using a container. I do this like that:

$this->container->getParameter('someParam');

Now I want to have some parameters grouped withing a "namespace" like that:

system:
    CPU: "i7"
    ram: "8gb"

Now I cannot use $this->container->getParameter('system.CPU'); cause it will scream that "system.CPU" parameter is not set.

Any idea how to read nested parameters from controller?

1

2 Answers 2

3

In case of nested parameters you should treat this as an array. So in your case you should read:

$this->container->getParameter('system');

and what you get from it is an array:

array('CPU' => 'i7', 'ram' => '8gb')
Sign up to request clarification or add additional context in comments.

Comments

2

The call of $this->container->getParameter('system') will return an

array('CPU' => 'i7', 'ram' => '8gb') so you can use them easily as arrays.

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.