1

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

0

You should return following code:

return parent::_prepareLayout();

So _prepareLayout method looks like:

protected function _prepareLayout()
{
    // your modification

    return parent::_prepareLayout();
}
2
  • no , i find a mistake myself , i used _construct istead of __construct :)
    – Wahaj Moin
    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.
    – Sohel Rana
    Commented May 13, 2019 at 4:33

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.