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::
81
81
var_dump($propertyAccessor->getValue($persons, '[0][first_name]')); // 'Wouter'
82
82
var_dump($propertyAccessor->getValue($persons, '[1][first_name]')); // 'Ryan'
83
83
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
+
84
101
Reading from Objects
85
102
--------------------
86
103
You can’t perform that action at this time.
0 commit comments