How to get the existing product id from my Model.
<?php
class SyncObserver implements ObserverInterface {
function __construct
(
\Vendor\Module\Model\Engine $syncEngineFactory
) {
$this->syncEngineFactory = $syncEngineFactory;
}
public function execute(\Magento\Framework\Event\Observer $observer) {
$product = $observer->getEvent()->getProduct();
$this->productUpdate($product);
return $this;
public function productUpdate($product){
$productId = 1;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$currentproduct = $objectManager->create('Vendor\Module\ResourceModel\Queue')->load($productId,'entity_id'); //Erro here 'Recoverable Error: Argument 1 passed to Magento\Framework\Model\ResourceModel\Db\AbstractDb::load()
}
}
UPDATE:
Event is : catalog_product_save_after
<event name="catalog_product_save_after">
<observer name="catalog_product_save_after_handler" instance="Vendor\Module\Observer\SyncObserver"/>
</event>