Using PHP YAML Extension and Unicode on Entity column with Doctrine Events

0 Flares Twitter 0 Facebook 0 LinkedIn 0 0 Flares ×

I have a Rails legacy database that uses a YAML formatted array in a column. My new App is based on Symfony2 and Doctrine2.

To make this column useable in Sonata Admin I had to (re-)convert between PHP Array and YAML.

 

This worked fine using Doctrine Events:

 

Note the YAML_UTF8_ENCODING constant when emitting. By default yaml_emit uses the YAML_ANY_ENCODING constant.

All constants can be found here:

http://php.net/manual/en/yaml.constants.php

Web Deviloper