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
Reactions are currently unavailable
As of 2.6 series[1] you introduced objectMap parsing, but there is currently no support for both dumping and parsing it again.
[1] http://symfony.com/blog/new-in-symfony-2-6-support-for-object-maps-in-yaml-component