John Davidson

php - Subscribe to Event which does not have an event name

0 comments
Message:


I try to subscribe to the Event in Shopware 6.3.5


\Shopware\Core\Content\ImportExport\Event\ImportExportBeforeImportRecordEvent

The class does not define an EVENT_NAME, which I seem to need according to the docs:
https://developer.shopware.com/docs/guides/plugins/plugins/plugin-fundamentals/listening-to-events


public static function getSubscribedEvents(): array
{
// Return the events to listen to as array like this: <event to listen to> => <method to execute>
return [
ProductEvents::PRODUCT_LOADED_EVENT => 'onProductsLoaded'
];
}

What do I enter as array key for the subscribed events now?



My Answer:
return [
ImportExportBeforeImportRecordEvent::class => 'onImportExportBeforeImportRecord',
];
}

Rate this post

4 of 5 based on 1065 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us