0

Just wrote the following controller:

namespace MySite\MyCustomModule\Controller\Dashboard;

use Magento\Customer\Controller\AccountInterface;
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
use Magento\Framework\View\Result\PageFactory;

class Index implements AccountInterface, HttpGetActionInterface
{
    /**
     * @var PageFactory
     */
    protected $resultPageFactory;

    /**
     * @param PageFactory $resultPageFactory
     */
    public function __construct(
        PageFactory $resultPageFactory
    ) {
        $this->resultPageFactory = $resultPageFactory;
    }

    /**
     * Default customer account page
     *
     * @return \Magento\Framework\View\Result\Page
     */
    public function execute()
    {
    
        return $this->resultPageFactory->create();
    }
}

However, when trying to get results,

also di.xml

enter image description here

go to the needed route http://mysite.lo/customer/dashboard and get the following issue:

1 exception(s): Exception #0 (InvalidArgumentException): Invalid return type

Exception #0 (InvalidArgumentException): Invalid return type

#1 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:31]

and even debug cannot log in to method execute.

Does anyone face this issue?

1 Answer 1

0

Try ditching HttpGetActionInterface and instead extends Magento\Framework\App\Action\Action;

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.