订阅没有事件名称的事件

Subscribe to Event which does not have an event name

我尝试在 Shopware 6.3.5 中订阅活动

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

class 没有定义 EVENT_NAME,根据文档我似乎需要它: 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'
    ];
}

我现在要输入什么作为订阅事件的数组键?

很简单 - 使用 class 名称:

use Shopware\Core\Content\ImportExport\Event\ImportExportBeforeImportRecordEvent;

...

public static function getSubscribedEvents(): array
{
    return [
        ImportExportBeforeImportRecordEvent::class 
            => 'onImportExportBeforeImportRecord'
    ];
}