Tobias Pierschel
Tobias Pierschel

Reputation: 81

Import Export Profil in Shopware 6.5 - how to use ImportExportBeforeImportRecordEvent

In Shopware 6.4 we created a separate import / export profile for our plugin and used EntityRepositoryDecorator. With Shopware 6.5 there is no longer an EntityRepositoryDecorator. The goal is to change the data of the entity during import before it is written to the database. For this we could use the event ImportExportBeforeImportRecordEvent, unfortunately we have no information about which entity is being imported and cannot check this. We cannot execute the code to change the data for each individual entity.

Upvotes: 0

Views: 505

Answers (1)

Michael T
Michael T

Reputation: 927

You can get the entity name from the config provided by the event.

public function callbackMethodName $event): void
{
    $entityName = $event->getConfig()->get('sourceEntity');
    // ...
}

See ProductCategoryPathsSubscriber for an example.

Upvotes: 1

Related Questions