Skip to main content
deleted 2 characters in body; edited tags; edited title
Source Link

Fatel Fatal Error Call to a member function dispatch() while call my Block in magento 2

This is my Block File:

 <?php namespace ChennaiBox\Mymail\Block\Mail; class MailContent extends \Magento\Framework\View\Element\Template { protected $_objectManager; protected $customerSession; public function __construct( \Magento\Customer\Model\Session $customerSession, \Magento\Framework\ObjectManagerInterface $objectManager ) { $this->customerSession = $customerSession; $this->_objectManager = $objectManager; } public function mymailData() { try{ if ($this->customerSession->isLoggedIn()) { $cutomerEmail =(string)$this->customerSession->getCustomer()->getEmail(); echo $cutomerEmail; else{ $this->_redirect('customer/account/login/'); } }catch (Exception $e) { $e->getMessage(); } } } 

If I call this block I get error

PHP Fatal error: Call to a member function dispatch() on null in /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php on line 642, referer: http://magentodev.gworks.mobi/magento2/customer/account/index/

from apache error.logerror.log file., why, suggect me how to solve this problem.

Fatel Error Call to a member function dispatch() while call my Block in magento 2

This is my Block File:

 <?php namespace ChennaiBox\Mymail\Block\Mail; class MailContent extends \Magento\Framework\View\Element\Template { protected $_objectManager; protected $customerSession; public function __construct( \Magento\Customer\Model\Session $customerSession, \Magento\Framework\ObjectManagerInterface $objectManager ) { $this->customerSession = $customerSession; $this->_objectManager = $objectManager; } public function mymailData() { try{ if ($this->customerSession->isLoggedIn()) { $cutomerEmail =(string)$this->customerSession->getCustomer()->getEmail(); echo $cutomerEmail; else{ $this->_redirect('customer/account/login/'); } }catch (Exception $e) { $e->getMessage(); } } } 

If I call this block I get error

PHP Fatal error: Call to a member function dispatch() on null in /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php on line 642, referer: http://magentodev.gworks.mobi/magento2/customer/account/index/

from apache error.log file., why, suggect me how to solve this problem.

Fatal Error Call to a member function dispatch() while call my Block in magento 2

This is my Block File:

 <?php namespace ChennaiBox\Mymail\Block\Mail; class MailContent extends \Magento\Framework\View\Element\Template { protected $_objectManager; protected $customerSession; public function __construct( \Magento\Customer\Model\Session $customerSession, \Magento\Framework\ObjectManagerInterface $objectManager ) { $this->customerSession = $customerSession; $this->_objectManager = $objectManager; } public function mymailData() { try{ if ($this->customerSession->isLoggedIn()) { $cutomerEmail =(string)$this->customerSession->getCustomer()->getEmail(); echo $cutomerEmail; else{ $this->_redirect('customer/account/login/'); } }catch (Exception $e) { $e->getMessage(); } } } 

If I call this block I get error

PHP Fatal error: Call to a member function dispatch() on null in /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php on line 642, referer: http://magentodev.gworks.mobi/magento2/customer/account/index/

from apache error.log file., why, suggect me how to solve this problem.

This is my Block File:

 <?php namespace ChennaiBox\Mymail\Block\Mail; class MailContent extends \Magento\Framework\View\Element\Template { protected $_objectManager; protected $customerSession; public function __construct( \Magento\Customer\Model\Session $customerSession, \Magento\Framework\ObjectManagerInterface $objectManager ) { $this->customerSession = $customerSession; $this->_objectManager = $objectManager; } public function mymailData() { try{ if ($this->customerSession->isLoggedIn()) { $cutomerEmail =(string)$this->customerSession->getCustomer()->getEmail(); echo $cutomerEmail; else{ $this->_redirect('customer/account/login/'); } }catch (Exception $e) { $e->getMessage(); } } } 

If I call this block I get error

PHP Fatal error: Call to a member function dispatch() on null in /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php on line 642, referer: http://magentodev.gworks.mobi/magento2/customer/account/index/ PHP Fatal error: Call to a member function dispatch() on null in /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php on line 642, referer: http://magentodev.gworks.mobi/magento2/customer/account/index/

Fromfrom apache error.logerror.log file., why, suggect me how to solve this problem.

This is my Block File:

 <?php namespace ChennaiBox\Mymail\Block\Mail; class MailContent extends \Magento\Framework\View\Element\Template { protected $_objectManager; protected $customerSession; public function __construct( \Magento\Customer\Model\Session $customerSession, \Magento\Framework\ObjectManagerInterface $objectManager ) { $this->customerSession = $customerSession; $this->_objectManager = $objectManager; } public function mymailData() { try{ if ($this->customerSession->isLoggedIn()) { $cutomerEmail =(string)$this->customerSession->getCustomer()->getEmail(); echo $cutomerEmail; else{ $this->_redirect('customer/account/login/'); } }catch (Exception $e) { $e->getMessage(); } } } 

If I call this block I get error

PHP Fatal error: Call to a member function dispatch() on null in /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php on line 642, referer: http://magentodev.gworks.mobi/magento2/customer/account/index/

From apache error.log file., why, suggect me how to solve this problem.

This is my Block File:

 <?php namespace ChennaiBox\Mymail\Block\Mail; class MailContent extends \Magento\Framework\View\Element\Template { protected $_objectManager; protected $customerSession; public function __construct( \Magento\Customer\Model\Session $customerSession, \Magento\Framework\ObjectManagerInterface $objectManager ) { $this->customerSession = $customerSession; $this->_objectManager = $objectManager; } public function mymailData() { try{ if ($this->customerSession->isLoggedIn()) { $cutomerEmail =(string)$this->customerSession->getCustomer()->getEmail(); echo $cutomerEmail; else{ $this->_redirect('customer/account/login/'); } }catch (Exception $e) { $e->getMessage(); } } } 

If I call this block I get error

PHP Fatal error: Call to a member function dispatch() on null in /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php on line 642, referer: http://magentodev.gworks.mobi/magento2/customer/account/index/

from apache error.log file., why, suggect me how to solve this problem.

added 15 characters in body; edited tags
Source Link

This is my Block File:

 <?php namespace ChennaiBox\Mymail\Block\Mail; class MailContent extends \Magento\Framework\View\Element\Template { protected $_objectManager; protected $customerSession; public function __construct( \Magento\Customer\Model\Session $customerSession, \Magento\Framework\ObjectManagerInterface $objectManager ) { $this->customerSession = $customerSession; $this->_objectManager = $objectManager; } public function mymailData() { try{ if ($this->customerSession->isLoggedIn()) { $cutomerEmail =(string)$this->customerSession->getCustomer()->getEmail(); echo $cutomerEmail; else{ $this->_redirect('customer/account/login/'); } }catch (Exception $e) { $e->getMessage(); } } } 

If I call this block I get error PHP Fatal error: Call to a member function dispatch() on null in /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php on line 642, referer: http://magentodev.gworks.mobi/magento2/customer/account/index/ from

PHP Fatal error: Call to a member function dispatch() on null in /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php on line 642, referer: http://magentodev.gworks.mobi/magento2/customer/account/index/

From apache error.logerror.log file., why, suggect me how to solve this problem.

This is my Block File:

 <?php namespace ChennaiBox\Mymail\Block\Mail; class MailContent extends \Magento\Framework\View\Element\Template { protected $_objectManager; protected $customerSession; public function __construct( \Magento\Customer\Model\Session $customerSession, \Magento\Framework\ObjectManagerInterface $objectManager ) { $this->customerSession = $customerSession; $this->_objectManager = $objectManager; } public function mymailData() { try{ if ($this->customerSession->isLoggedIn()) { $cutomerEmail =(string)$this->customerSession->getCustomer()->getEmail(); echo $cutomerEmail; else{ $this->_redirect('customer/account/login/'); } }catch (Exception $e) { $e->getMessage(); } } } 

If I call this block I get error PHP Fatal error: Call to a member function dispatch() on null in /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php on line 642, referer: http://magentodev.gworks.mobi/magento2/customer/account/index/ from apache error.log file., why, suggect me how to solve this problem.

This is my Block File:

 <?php namespace ChennaiBox\Mymail\Block\Mail; class MailContent extends \Magento\Framework\View\Element\Template { protected $_objectManager; protected $customerSession; public function __construct( \Magento\Customer\Model\Session $customerSession, \Magento\Framework\ObjectManagerInterface $objectManager ) { $this->customerSession = $customerSession; $this->_objectManager = $objectManager; } public function mymailData() { try{ if ($this->customerSession->isLoggedIn()) { $cutomerEmail =(string)$this->customerSession->getCustomer()->getEmail(); echo $cutomerEmail; else{ $this->_redirect('customer/account/login/'); } }catch (Exception $e) { $e->getMessage(); } } } 

If I call this block I get error

PHP Fatal error: Call to a member function dispatch() on null in /var/www/html/magento2/vendor/magento/framework/View/Element/AbstractBlock.php on line 642, referer: http://magentodev.gworks.mobi/magento2/customer/account/index/

From apache error.log file., why, suggect me how to solve this problem.

Source Link
Rajkumar Elumalai
  • 3.6k
  • 8
  • 43
  • 74
Loading