Single controller action for POST and GET form (symfony) vs separate action (laravel) - what speaks for symfony?
symfony argues this:
Rendering forms and processing forms are two of the main tasks when handling forms. Both are too similar (most of the time, almost identical), so it's much simpler to let a single controller action handle both.
https://symfony.com/doc/6.0/best_practices.html#use-a-single-action-to-render-and-process-the-form
now I think I disagree with it (I much seem to prefer https://www.youtube.com/watch?v=MF0jFKvS4SI&ab_channel=AdamWathan ). The thing is, the symfony forms ( https://symfony.com/doc/current/components/form.html ) and processing is done in a way that it simplifies actually doing it in one controller. There is no form component with laravel, and thus less incentives to reuse the same controller function (as you dont have to initialize the form component). What I saw as well a lot is that after validation failing, in symfony you dont do a redirect but instead do a rerender https://github.com/symfony/demo/blob/main/src/Controller/BlogController.php#L131 . This actually causes the user on pressing ctrl+r or refresh, to resubmit the form again which I don't think is what is intended behaviour?
Is there something I am missing? What do you guys subjectively prefer? submitted by /u/Iossi_84
[link] [comments]
0 comments:
Post a Comment
Thanks