-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added note on YAML mappings as objects #6590
Conversation
Yaml mappings_ are basically associative arrays. You can instruct the parser to return | ||
mappings as objects (i.e. ``\stdClass`` instances):: | ||
|
||
$object = $parser->parse('{"hello": "world"}', false, false, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should make use of Yaml::parse()
1100921
to
35f85e4
Compare
Updated. |
34f243e
to
983720d
Compare
closes #6524. |
|
||
.. versionadded:: 2.7 | ||
|
||
This feature was introduced in Symfony 2.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this just below the "Objects for Mappings" headline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And we can reword this a bit:
Support for parsing mappings as objects was introduced in Symfony 2.7.
983720d
to
5bf8d32
Compare
echo $object->foo; // bar | ||
|
||
.. versionadded:: 2.7 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this empty line should be removed (versionadded directive is a strange one)
Updated |
.................... | ||
|
||
.. versionadded:: 2.7 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after your pushes, it's this line that should be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i saw :)
83ba2fb
to
81ea3e2
Compare
Updated |
81ea3e2
to
95c8031
Compare
.................... | ||
|
||
.. versionadded:: 2.6 | ||
Support for parsing mappings as objects was introduced in Symfony 2.6. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was added in 2.7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it was added to Parser
in 2.6 and and Yaml::parse
in 2.7 :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should prefer the static API (see #6598) so using 2.7 here is the best idea imo.
👍 |
|
||
Yaml :ref:`mappings <yaml-format-collections>` 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``:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fourth
95c8031
to
0b4b6ea
Compare
👍 |
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.0 Depends on #6582 Commits ------- e9de4ca Added note on YAML mappings as objects
Thank you @dantleech! |
* 2.7: Simplified the contribution article for Symfony Docs Update routing.rst [#6590] fix version in versionadded directive Added note on YAML mappings as objects use static Yaml API Adding a description for the use_microseconds parameter introduced in MonologBundle v2.11 Clarify signed requests in the ESI renderer
* 2.8: Simplified the contribution article for Symfony Docs Update routing.rst [#6590] fix version in versionadded directive Added note on YAML mappings as objects use static Yaml API Adding a description for the use_microseconds parameter introduced in MonologBundle v2.11 Clarify signed requests in the ESI renderer
* 3.0: Simplified the contribution article for Symfony Docs Update routing.rst [#6590] fix version in versionadded directive Added note on YAML mappings as objects use static Yaml API Adding a description for the use_microseconds parameter introduced in MonologBundle v2.11 Clarify signed requests in the ESI renderer refs #5898 Fix updates of testing.rst for 3.0
Depends on #6582