8000 YAML Dumper to support objectMap · Issue #12860 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

YAML Dumper to support objectMap #12860

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

Closed
norrs opened this issue Dec 4, 2014 · 4 comments
Closed

YAML Dumper to support objectMap #12860

norrs opened this issue Dec 4, 2014 · 4 comments
Labels

Comments

@norrs
Copy link
norrs commented Dec 4, 2014

As of 2.6 series[1] you introduced objectMap parsing, but there is currently no support for both dumping and parsing it again.

<?php

class ObjectMapTest extends PHPUnit_Framework_TestCase {

    public function testParseValidYamlWithObjectMap__andDumpParsedYamlWithObjectMap__andParseSameYamlWithObjectMapAgain__ShouldEqual() {
        $yaml = <<< EOF
----------------
foo:
  bar:
    class: "classBar"
    args:
      - "bar"
  zar:
    class: "classZar"
    args: [ ]
EOF;
        $parser = new \Symfony\Component\Yaml\Parser();
        $dumper = new \Symfony\Component\Yaml\Dumper();

        $objectMap = true;
        $objectSupport = false;
        $exceptionOnInvalidType = true;

        $originalParse = $parser->parse($yaml, $exceptionOnInvalidType, $objectSupport, $objectMap);

        // Problem: dumper doesn't have any input for $objectMap ..
        $test = $dumper->dump($originalParse, 10, 0, $exceptionOnInvalidType, $objectSupport);

        // So this one fails :-(
        $this->assertEquals($originalParse, $parser->parse($test, $exceptionOnInvalidType, $objectSupport, $objectMap));
    }

}

[1] http://symfony.com/blog/new-in-symfony-2-6-support-for-object-maps-in-yaml-component

@norrs
Copy link
Author
norrs commented Dec 4, 2014

Related to PR #10552 ([YAML] Added support for object-maps)

@stof stof added the Yaml label Dec 5, 2014
@javiereguiluz
Copy link
Member

Closing it as fixed as of #17578.

8000

@xabbuh
Copy link
Member
xabbuh commented Feb 8, 2016

Reopening here, we are not there yet, but the changes introduced in #17578 allow to easily implement this feature.

@xabbuh xabbuh reopened this Feb 8, 2016
@xabbuh xabbuh added this to the 3.1 milestone Feb 8, 2016
@xabbuh
Copy link
Member
xabbuh commented Feb 8, 2016

see #17728

fabpot added a commit that referenced this issue Feb 28, 2016
This PR was merged into the 3.1-dev branch.

Discussion
----------

[Yaml] add option to dump objects as maps

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #9870, #12860, #15781, #15937, #16266
| License       | MIT
| Doc PR        | TODO

Commits
-------

3941d2e [Yaml] add option to dump objects as maps
@fabpot fabpot closed this as completed Feb 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants
0