Doctrine ArrayCollection in a human readable format

I'm persisting a field of type ArrayCollection to a MySQL database which contains only stings. The database field is of type=array in the ORM definition and of type TEXT in the database.

/**
 * @var ArrayCollection
 *
 * @ORM\Column(name="currencies", type="array")
 */
private $currencies;

When persisted the field looks like this in the database:

O:43:"Doctrine\Common\Collections\ArrayCollection":1:{s:54:"Doctrine\Common\Collections\ArrayCollection_elements";a:3:{i:0;s:3:"EUR";i:1;s:3:"USD";i:2;s:3:"GBP";}}

There is a way to get a json array into the database. Just use type=json_array instead of type=array in your field definition. That way the result looks more readable:

['EUR', 'USD', 'GBP']

If you want a simple list without the JSON you can also use type=simple_array and expect the following result:

EUR,USD,GBP

Just make sure, that you don't have content which contains a , as this is used as delimiter.