0

Magento 2 controller file created for each action like add,edit, delete, update, get. I want to know about the advantage of creation controllers for each action.

-1

Magento 2 works like this, your code will be more readable and reusable.

Single responsibility is probably the most known of the SOLID design principles. This means when writing a class it should only have one responsibility, or do one thing.

Common offenders of this rule are having validation or formatting methods within models or classes. We are all guilty of doing this, however doing so isn’t very maintainable.

To write code which is legible and reusable you should write format or validation objects, their single responsibility would be to format or validate your other objects.

Source: https://nathanmcbride.io/magento2/SOLID-in-Magento-2

  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – Jai Apr 9 '18 at 6:48
  • 1
    I've just updated my answer. – Jonathan Ribas Apr 9 '18 at 6:57
  • thats make it good answer. – Jai Apr 9 '18 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.