Answer the question
In order to leave comments, you need to log in
symfony. How to handle duplicate code in a controller?
The controller has two methods new and edit . Which essentially new creates a new post and edit edits itself. So, there is a piece of code (I see no reason to show it) when adding a new article (new) and which processes the file name (picture) and uploads it to the server. And there is an article editing (edit) which allows you to upload the file in the same way. And there is the same piece of code as in the new method.
Whether it is possible to carry out somehow it in a separate method correctly ? It's just that somehow I did not find any examples or anything about this in the documentation.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question