File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,20 @@ 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 ``. ``, a left squared bracket ``[ ``
87
+ or a right squared bracket ``] ``, it is possible to escape these characters
88
+ with a backslash. In the above example, if the array key becomes ``first.name ``,
89
+ accessing the value can 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
+ .. versionadded :: 6.3
95
+
96
+ Escaping dots and squared brackets in a property path was introduced in Symfony 6.3.
97
+
84
98
Reading from Objects
85
99
--------------------
86
100
You can’t perform that action at this time.
0 commit comments