I have created a event listener for product. Now how can i difference in Event Listener that the Product Create event has fired from importer or from Pimcore back-end.
Basically listen on the events
pimcore.dataobject.postAdd and then do a simple instanceof check in the listener like
$subject instanceof Product
Thanks for Reply,
I have already add $object instance of Product condition before and it will only get triggered in product instance. But i had also created product importer as well so i need to find whether that event was triggered from my importer or from pimcore admin panel when i create product from there.
You can call the save() method with additional parameter array (eg. [‘context’ => ‘importer’]) like it is done with param ‘versionNote’.
Then inside your listener for dataobject.postUpdate you are able to retrieve this from the $event by calling getArgument(‘context’) to distinguish between product creation from importer and pimcore backend.