FriendsOfSymfony / FOSRestBundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony
http://symfony.com/doc/master/bundles/FOSRestBundle/index.html
MIT License
2.79k stars 703 forks source link

Be able create multiple viewHandlers #527

Closed tarjei closed 4 years ago

tarjei commented 11 years ago

Different bundles needs different variations of viewhandler configurations. It would be nice to have a simple mechanism for creating them.

My usecase: FOS Comment bundle needs the templating handlers configured with json to be templated, I do not want that in another bundle that I'm implementing now.

lsmith77 commented 11 years ago

Well you can obviously define your own view handler service. Any controllers defined as services should then allow you to easily adjust the view handler service to use.

lsmith77 commented 11 years ago

with #552 I have introduced the concept of per path/host config for the format listener. it would be slightly trickier to do the same here. also i wonder what the performance overhead will be if we keep adding more and more request matchers

tarjei commented 11 years ago

Hmm, I ended up just defining an extra service. Maybe some way to define extra viewhandlers in the config is what is needed? I.e. something that is generated in the compile step and thus will incur a much smaller performance penalty.

lsmith77 commented 11 years ago

We could in theory support an approach similar to doctrine connections. where one can either define just one "connection" called "default" or multiple named connections.

lsmith77 commented 9 years ago

this will hopefully be addressed with https://github.com/FriendsOfSymfony/FOSRestBundle/pull/955