Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate the need for inheritance for action controllers #9

Open
magento-engcom-team opened this issue Dec 11, 2017 · 0 comments

Comments

@magento-engcom-team
Copy link

@magento-engcom-team magento-engcom-team commented Dec 11, 2017

By design, all Magento action controllers should implement \Magento\Framework\App\ActionInterface. But some crucial request processing behavior (event dispatching, authorisation, etc) resides in classes like \Magento\Framework\App\Action\Action and \Magento\Backend\App\AbstractAction. So if an action controller implements the ActionInterface but does not inherit from one of these "layer supertype" classes, it will lose that crucial behavior.

So, Magento module developers do not have a way to create an action controller without using inheritance. To avoid inheritance (see why), the request processing behavior should be extracted from "layer supertypes". Proposed solution is to move the behavior to action controller plugins.

Action controller should contain only its custom behavior.

AC:

  • module developer does not have to extend from any class to create a fully functional action controller, implementing \Magento\Framework\App\ActionInterface is enough
  • controllers "supertypes" (\Magento\Backend\App\AbstractAction, \Magento\Framework\App\Action\Action, \Magento\Framework\App\Action\AbstractAction) are deprecated
  • magento supports both controller implementations (inheritance based and non-inheritance based)
  • [optional] controllers are migrated

Original Report: magento/magento2#9582 by @antonkril

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.