I am trying to extend the \Magento\Framework\App\Action\HttpPostActionInterface class and my construct looks like this:

public function __construct(
    \Magento\Framework\App\Action\Context $context,
    \Magento\Framework\View\Result\PageFactory $pageFactory,
    \Magento\Framework\Message\ManagerInterface $messageManager,
    \Magento\Framework\HTTP\Client\Curl $curl,
    \Magento\Framework\File\UploaderFactory $uploaderFactory)
    $this->_curl = $curl;
    $this->messageManager = $messageManager;
    $this->_pageFactory = $pageFactory;
    $this->uploaderFactory = $uploaderFactory;
    return parent::__construct($context);

I am getting an error though on this line return parent::__construct($context);

Cannot use 'parent' in a class with no parent.

How else should I write the return line then?

  • What does your class definition look like, i.e. the part where you extend the HttpPostActionInterface class?
    – joeybab3
    Jun 30, 2021 at 17:36
  • class submitForm extends \Magento\Framework\App\Action\HttpPostActionInterface Jun 30, 2021 at 19:53
  • I see you are confusing this as an interface how do you extend it . you are using class to create an extension for an interface
    – nhungo duc
    Jul 1, 2021 at 4:39

2 Answers 2


You cannot extend \Magento\Framework\App\Action\HttpPostActionInterface because it's an interface. You can implement it - in this case parent constructor calling is impossible.

I guess you need to extend certain action class instead of general interface.


Instead of extending \Magento\Framework\App\Action\HttpPostActionInterface you implement it. Since this is an interface, you cannot extend

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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