help needed i am creating a factory in block and get data from model it give result in block but when i return this factory and use this block function in phtml file it give error " Fatal error: Uncaught Error: Call to a member function dispatch() on null in C:\wamp64\www\hum\vendor\magento\framework\View\Element\AbstractBlock.php on line 652 "
1 Answer
You should return following code:
return parent::_prepareLayout();
So _prepareLayout method looks like:
protected function _prepareLayout()
{
// your modification
return parent::_prepareLayout();
}
-
no , i find a mistake myself , i used _construct istead of __construct :) Commented May 12, 2019 at 17:12
-
But you didn't update your question regarding that. Also, you must apply changes according to my answer as well. Commented May 13, 2019 at 4:33