Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parameters as array in Yaml in Symfony2

Tags:

yaml

symfony

I'm doing this which works fine:

parameters:  array_name1: [a, b, c, d]  array_name2: [x, y, a, b] 

Now I need to add what in PHP would be $array_name3[1] = array("a", "b", "c") etc., so something like this:

parameters:  array_name3[1]: [1, 2, 3]  array_name3[2]: [a, b, c]  array_name3[3]: [x, y, z] 

...which of course doesn't work. Nothing I try seems to be accepted.

How do I define multi-dimensional arrays in Yaml (Symfony2)?

like image 757
user2143356 Avatar asked Mar 21 '13 11:03

user2143356


1 Answers

Try this

parameters:    array_name3:        - [1, 2, 3]       - [a, b, c]       - [x, y, z] 

Or if you want to have it associative:

parameters:    array_name3:        1: [1, 2, 3]       2: [a, b, c]       bla: [x, y, z] 

Or if you want more - read documentation

like image 184
Vitalii Zurian Avatar answered Oct 03 '22 13:10

Vitalii Zurian