diff --git a/components/yaml/introduction.rst b/components/yaml/introduction.rst index c61b40fa0e4..6c3808929f6 100644 --- a/components/yaml/introduction.rst +++ b/components/yaml/introduction.rst @@ -148,6 +148,20 @@ error if something goes wrong by adding the filename to the message. .. _components-yaml-dump: +Objects for Mappings +.................... + +.. versionadded:: 2.6 + Support for parsing mappings as objects was introduced in Symfony 2.6. + +Yaml :ref:`mappings ` are basically associative +arrays. You can instruct the parser to return mappings as objects (i.e. +``\stdClass`` instances) by setting the forth argument to ``true``:: + + $object = Yaml::parse('{"foo": "bar"}', false, false, true); + echo get_class($object); // stdClass + echo $object->foo; // bar + Writing YAML Files ~~~~~~~~~~~~~~~~~~ diff --git a/components/yaml/yaml_format.rst b/components/yaml/yaml_format.rst index 0a776be2a70..2e9d24a95ef 100644 --- a/components/yaml/yaml_format.rst +++ b/components/yaml/yaml_format.rst @@ -165,6 +165,8 @@ YAML uses the ISO-8601 standard to express dates: # simple date 2002-12-14 +.. _yaml-format-collections: + Collections -----------