magento / magento/community-features
Eliminate the need for inheritance for action controllers
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 46
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
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](http://antonkril.github.io/code-reuse)), 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**: https://github.com/magento/magento2/issues/9582 by @antonkril
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing Magento\Framework\App\Action\Action, Magento\Framework\App\Action\AbstractAction, and Magento\Backend\App\AbstractAction with the existing action-controller processing flow. Investigate how event dispatching and authorization can be provided through action-controller plugins. Done means an ActionInterface-only controller is fully functional, the supertypes are deprecated, and both inheritance-based and non-inheritance-based controllers remain supported.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100