Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit76d7737

Browse files
committed
feature#6590 Added note on YAML mappings as objects (dantleech)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes#6590).Discussion----------Added note on YAML mappings as objects| Q | A| ------------- | ---| Doc fix? | no| New docs? | yes| Applies to | 2.7 > 3.0Depends on#6582Commits-------e9de4ca Added note on YAML mappings as objects
2 parents330d40d +e9de4ca commit76d7737

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

‎components/yaml/introduction.rst‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,20 @@ 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+
..versionadded::2.7
155+
Support for parsing mappings as objects was introduced in Symfony 2.6.
156+
157+
Yaml:ref:`mappings<yaml-format-collections>` are basically associative
158+
arrays. You can instruct the parser to return mappings as objects (i.e.
159+
``\stdClass`` instances) by setting the fourth argument to ``true``::
160+
161+
$object = Yaml::parse('{"foo": "bar"}', false, false, true);
162+
echo get_class($object); // stdClass
163+
echo $object->foo; // bar
164+
151165
Writing YAML Files
152166
~~~~~~~~~~~~~~~~~~
153167

‎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)

[8]ページ先頭

©2009-2025 Movatter.jp