Replace Action\Action in a controller with both Get and Post requests

actionmagento2

I'm trying to create a controller, but I need both Get and Post requests in this Controller. What's my alternative?

I can do 2 lines like this

use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\App\Action\HttpPostActionInterface;

but then what do I use for the Class extends? I used to do Class extends Action, but that's not an option anymore.

Thanks

Best Answer

class MyController implements HttpPostActionInterface, HttpGetActionInterface
Related Topic