How can I specify a metadata dir for the serializer used by FOSRestBundle, at controller level?
I can't set it up in config.yml
because in my case it depends on the request's route.
I've seen in JMSSerializer doc that I could use the following code
$serializer = JMS\Serializer\SerializerBuilder::create()
->addMetadataDir($someDir)
->build();
But how to apply it to an already instanciated serializer (or how to replace it)?