Closed mattjanssen closed 8 years ago
Form extension in Symfony bundle are designed to extend default Symfony components behaviors.
I trust Symfony with processing FormTypeJsonHttpFoundationExtension
after the FormTypeHttpFoundationExtension
.
However, we could bypass this step and directly set the form.type_extension.form.request_handler.class
parameter to
Elao\Bundle\JsonHttpFormBundle\Form\RequestHandler\JsonHttpFoundationRequestHandler
.
That would be more straightforward, how do you feel about this solution?
Here's an implementation: https://github.com/Elao/ElaoJsonHttpFormBundle/pull/5
Brilliant. I assume that overriding form.type_extension.form.request_handler.class
is less conflict-prone than relying on the order of the AppKernel::registerBundles()
array. There's always the chance that another bundle will be incompatible.
The best solution might be for Symfony's form builder to allow a stack of handlers to decide which one will handle the specific request.
Thanks for making this update.
Done!
The
FormTypeHttpFoundationExtension
is still loading and calling$builder->setRequestHandler(HttpFoundationRequestHandler)
at some point.How do you guarantee that your
FormTypeJsonHttpFoundationExtension
is built after the Symfony HttpFoundation extension? Otherwise you are only guessing at which request handler will get used. Are you just relying on the bundle order as specified in theAppKernel
?I've been trying to work this out with no success yet...