Why do i get this dispatch() on null error from my custom module
My error stack trace says:
Vendor\Module\Observer\SyncObserver->execute( ) ..\InvokerDefault.php:73
Vendor\Module\Model\Engine->productUpdate( ) ..\SyncObserver.php:35
Vendor\Module\Observer\SyncObserver.php
<?php
namespace Vendor\Module\Observer;
use \Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
class SyncObserver implements ObserverInterface
{
protected $syncEngineFactory;
protected $logger;
function __construct
(
\Vendor\Module\Model\Engine $syncEngineFactory
)
{
$this->syncEngineFactory = $syncEngineFactory;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$event = $observer->getEvent();
$this->syncEngineFactory->saleOrderComplete($observer);
$this->syncEngineFactory->productUpdate($observer);
$this->syncEngineFactory->productDelete($observer);
}
etc/events.xml
<event name="catalog_product_save_after">
<observer name="catalog_product_save_after_handler" instance="Vendor\Module\Observer\SyncObserver"/>
</event>
dispatch()
event which you want to catch?