N
N
Nikolino2018-11-29 16:56:04
symfony
Nikolino, 2018-11-29 16:56:04

Should edit and update methods of the controller be combined?

I'm trying to understand the best practices for working with forms.
There is an edit() controller method that creates a form and returns a view.
The docs indicate that, by default, the form is submitted to itself, but with the POST method.
So the update() method, which accepts and updates the form data, is no longer needed?
That is, in one edit() method, we create a form, process it there, and if everything is ok, then we will update the data?
Is this good practice?
On the one hand, we get rid of the extra method in the controller, on the other hand, we do a lot of things in the edit () method.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question