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 " enter image description here
1 Answer 1
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 :)Wahaj Moin– Wahaj Moin2019年05月12日 17:12:08 +00:00Commented 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.Sohel Rana– Sohel Rana2019年05月13日 04:33:22 +00:00Commented May 13, 2019 at 4:33