Coder Social home page Coder Social logo

Comments (7)

lsmith77 avatar lsmith77 commented on May 12, 2024

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.

lenar avatar lenar commented on May 12, 2024

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.

lsmith77 avatar lsmith77 commented on May 12, 2024

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.

lenar avatar lenar commented on May 12, 2024

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.

lsmith77 avatar lsmith77 commented on May 12, 2024

I still dont get what the RestBundle is supposed to do here.

from fosrestbundle.

lenar avatar lenar commented on May 12, 2024

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.

lsmith77 avatar lsmith77 commented on May 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.