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

0

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 May 12 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 May 13 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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