Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

dantleech
Copy link
Contributor

Q A
Doc fix? no
New docs? yes
Applies to 2.7 > 3.0

Depends on #6582

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);
Copy link
Member

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

@dantleech
Copy link
Contributor Author

Updated.

@dantleech dantleech force-pushed the yaml_object_for_map branch 2 times, most recently from 34f243e to 983720d Compare May 21, 2016 16:24
@HeahDude
Copy link
Contributor

HeahDude commented May 21, 2016

closes #6524.


.. versionadded:: 2.7

This feature was introduced in Symfony 2.7
Copy link
Member

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.

Copy link
Member

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.

echo $object->foo; // bar

.. versionadded:: 2.7

Copy link
Member

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)

@dantleech
Copy link
Contributor Author

Updated

....................

.. versionadded:: 2.7

Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i saw :)

@dantleech dantleech force-pushed the yaml_object_for_map branch 2 times, most recently from 83ba2fb to 81ea3e2 Compare May 21, 2016 17:14
@dantleech
Copy link
Contributor Author

dantleech commented May 21, 2016

Updated

....................

.. versionadded:: 2.6
Support for parsing mappings as objects was introduced in Symfony 2.6.
Copy link
Member

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.

Copy link
Contributor Author

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 :/

Copy link
Member

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.

@HeahDude
Copy link
Contributor

👍


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``::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fourth

@wouterj
Copy link
Member

wouterj commented May 21, 2016

👍

xabbuh added a commit that referenced this pull request May 21, 2016
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
xabbuh added a commit that referenced this pull request May 21, 2016
@xabbuh
Copy link
Member

xabbuh commented May 21, 2016

Thank you @dantleech!

@xabbuh xabbuh closed this May 21, 2016
xabbuh added a commit that referenced this pull request May 21, 2016
* 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
xabbuh added a commit that referenced this pull request May 21, 2016
* 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
xabbuh added a commit that referenced this pull request May 21, 2016
* 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
weaverryan added a commit that referenced this pull request Sep 17, 2016
This PR was merged into the 3.1 branch.

Discussion
----------

Documentation for YAML flags added in 3.1

Following on from #6590 this PR documents the YAML flags introduced in Symfony 3.1

Commits
-------

3895fc9 Documentation for YAML flags added in 3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants