On Magento 2.4 i found this class extends (extends \Magento\Framework\App\Action\Action) show deprecated.

Ref : Screenshot at end of the question

But Magento core use this code. I mean in core code they extends this class.

As per knowledge if a code get deprecated then on next release it may get removed, so there must be alternative code for the deprecated code. How can we easily found alternative for list of deprecated code in Magento 2?

enter image description here


This approach is deprecated because of the favor of composition over inheritance.

So instead of:

class YourClass extends \Magento\Framework\App\Action\Action


class YourClass implements \Magento\Framework\App\ActionInterface

and add your logic to the execute() method.

It's true though that there's still a lot of Magento core code that uses the deprecated approach. So this will not be removed soon, if they will ever do.

  • Thank you for a simple explanation :)
    – Zankar
    Dec 2 '21 at 11:11

Maybe I am late with the answer.

In Magento 2.4 Action classes are implementations of the ActionInterface that a router returns on matched requests. The execute() function in these classes contain the logic for dispatching requests.

More details can be found here

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.