8000 Added note on YAML mappings as objects · symfony/symfony-docs@34f243e · GitHub
[go: up one dir, main page]

Skip to content

Commit 34f243e

Browse files
committed
Added note on YAML mappings as objects
1 parent 330d40d commit 34f243e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

components/yaml/introduction.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,17 @@ error if something goes wrong by adding the filename to the message.
148148

149149
.. _components-yaml-dump:
150150

151+
Objects for Mappings
152+
....................
153+
154+
Yaml :ref:`mappings <yaml-format-collections>` are basically associative
155+
arrays. You can instruct the parser to return mappings as objects (i.e.
156+
``\stdClass`` instances)::
157+
158+
$object = Yaml::parse('{"hello": "world"}', false, false, true);
159+
echo get_class($object); // stdClass
160+
echo $object->hello; // world
161+
151162
Writing YAML Files
152163
~~~~~~~~~~~~~~~~~~
153164

components/yaml/yaml_format.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ YAML uses the ISO-8601 standard to express dates:
165165
# simple date
166166
2002-12-14
167167
168+
.. _yaml-format-collections:
169+
168170
Collections
169171
-----------
170172

0 commit comments

Comments
 (0)
0