File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,23 @@ You can also use multi dimensional arrays::
8181 var_dump($propertyAccessor->getValue($persons, '[0][first_name]')); // 'Wouter'
8282 var_dump($propertyAccessor->getValue($persons, '[1][first_name]')); // 'Ryan'
8383
84+ .. tip ::
85+
86+ If the key of the array contains a dot ``. `` or a left squared bracket ``[ ``,
87+ it is possible to escape these characters with a backslash. In the above example,
88+ if the array key ``first_name `` becomes ``first.name ``, accessing the value can
89+ be achieved like this::
90+
91+ var_dump($propertyAccessor->getValue($persons, '[0][first\.name]')); // 'Wouter'
92+ var_dump($propertyAccessor->getValue($persons, '[1][first\.name]')); // 'Ryan'
93+
94+ Right squared brackets ``] `` don't need to be escaped.
95+
96+ .. versionadded :: 6.3
97+
98+ Escaping dots and left squared bracket in a property path was
99+ introduced in Symfony 6.3.
100+
84101Reading from Objects
85102--------------------
86103
You can’t perform that action at this time.
0 commit comments