Correct way to serialize data outside of an entity using JMSSerializerBundle
I have an entity, which returns all the data I want (from the entity,
anyway). I also want to return some configuration parameters as well, if I
was in a service, controller or anywhere where I had access to the
container I'd simply do:
$this->container->getParameter('my.setting');
However, I obviously don't have (and rightfully so) access to the
container within an entity.
So my question is: how can I add my parameter to the output of the json
that JMSSerializerBundle generates?
No comments:
Post a Comment