I am new to Symfony and I was wondering how I would achieve this : I'm retrieving data from one entity, and one field is in JSON. It references data from other entities that I would like to convert into objects. Here is an example :
// JSON received
{items:"221,223",level:1,places:"12,15,17"}
I want this to be turned into :
Array(
'items' => array(
0 => Object(MyBundle/Entity/Item),
1 => Object(MyBundle/Entity/Item)
),
'level' => 1,
'places' => array(
0 => Object(MyBundle/Entity/Place),
1 => Object(MyBundle/Entity/Place)
),
)
What would be the best practice way of retrieving these Item
objects as calling an entity from another entity is not a good idea ?
I thought of serializing them as the embedded objects will be rather small, but is it the best solution ?
The JSON could contain many other entities, or none, the content is not fixed.