Comments (7)
Fixing other Bundle is beyond the scope of this Bundle. If you want to JSON-fy 3rd party Bundles I recommend looking at https://github.com/liip/MultiplexBundle
from fosrestbundle.
Really, I don't need multiplexing support. I want transparent output-format-agnostic support.
This bundle almost provides it (there is excellent support for exceptions) but falls short
converting normal (The Book) responses. I only think it would be nice if this bundle included
a way to specify serializer for this kind of cases. The bundle really has all the other components
needed. Why should I look at MultiplexBundle in this case? It's not logical.
Sorry if it's too much to be asked.
from fosrestbundle.
Maybe I didnt understand your request, but if you want to JSON-ify UserBundle actions, the MultiplexBundle does what you need, since it allows you to define what format you want returned. If you need something else could you maybe come up with a php example?
from fosrestbundle.
I didn't argue that MultiplexBundle wouldn'y give me what I need. Yes, it does. But it feels kind of hacky and certainly not as flexible as it can be. Maybe that's just me. But.
But this bundle would give me the support of different serializers and normalizers which would be very nice even
in the case of the common "return new Response(...)" and "return new RedirectResponse()" from the actions.
I would even argue that MultiplexBundle does too much - it should just multiplex. And the format conversion
should be done by some other bundle. Currently the RestBundle has the best implementation of this conversion.
So MultiplexBundle should IMHO actually live on and together with RestBundle.
And of course since exceptions can be already nicely and automatically converted to suitable format with this bundle I
only thought that handling (of course configurable as exceptions are) ordinary ...Responses in the same way would
only be consistent and logical. I really expected that this bundle does this when I found it - because it felt
right and because it's README.md had this sentence:
For now the Bundle provides a view layer to enable output format agnostic Controllers, which includes the ability to handle redirects differently based on a service container aware Serializer service that can lazy load encoders and normalizers.
This sentence really got me excited and I never thought it only provides this ability when using special View class. I really can see the format conversion for ordinary Responses can be done very efficiently in this bundle
(and so much more than MultiplexBundle) and so it makes sense for me.
Maybe I'm wrong. Maybe I'm missing something. I don't know.
from fosrestbundle.
I still dont get what the RestBundle is supposed to do here.
from fosrestbundle.
Provide a way to match the behavior of ordinary exceptions
framework:
exception_controller: 'FOS\RestBundle\Controller\ExceptionController::showAction'
for ordinary Responses.
Ok, I can provide some example code which maybe could be included in RestBundle but it takes a bit time.
Until then, let this conversation rest.
from fosrestbundle.
I still dont think this should be part of RestBundle, but I guess you can create a Response listener that does something. Still I dont know what the Response listener is supposed to do with the content of the 3rd party bundle. But if you got something you can send a PR and we can discuss further.
from fosrestbundle.
Related Issues (20)
- Two different headers for the same route
- Do not tag "RequestBodyParamConverter" as final.
- Invalid configuration for path "fos_rest.routing_loader": only "false" is supported HOT 3
- Exceptions mapped in config aren't caught anymore, 500 is thrown instead HOT 5
- Make FlattenExceptionHandler/FlattenExceptionNormalizer extensible
- Unwanted magic: converter fos_rest.request_body retrive the actualy entity from database?!
- Naive implementation of RequestBodyParamConverterwith POST... or it's just my bad?
- It's not possible to customize HTTP status code for failed validation HOT 7
- symfony/serializer 6.1 use NormalizerInterface instead. HOT 1
- The service ".service_locator.4yDV6ZJ" has a dependency on a non-existent service "FOS\RestBundle\View\ViewHandlerInterface" HOT 1
- Dependency on abandoned sensio/framework-extra-bundle HOT 3
- Exception serializer not been called
- Symfony 6.3 annotation issue HOT 4
- Disable exception stack trace HOT 1
- Deprecation warning after updating Symfony from version 6.2 to 6.3 HOT 2
- Configuration: Route FosRest and Attributes HOT 2
- Symfony 6.4 adds `@final` annotation to Route annotation/attribute class HOT 5
- Best way to learn FOSRestBundle API
- Symfony 7 dont support FOSRestBundle HOT 2
- NotAcceptableHttpException - No matching accepted Response format could be determined
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fosrestbundle.