title | issue | author | author_email | author_github |
---|---|---|---|---|
Import with update by mapping |
NEXT-16704 |
d.neustadt |
dneustadt |
- Added
update_by
json field toImportExportProfileDefinition
to include a mapping from each entity included in the import to a dedicated field which will be used to resolve the primary key from - Added
UpdateByCollection
ofUpdateBy
instances to containupdate_by
mapping - Changed
Shopware\Core\Content\ImportExport\Struct\Config
to receiveupdate_by
mapping for creating and servingUpdateByCollection
- Added
PrimaryKeyResolver
that will resolve primary keys within records by mappings ofUpdateByCollection
if provided - Changed
EntityPipe
andToOneSerializer
to callPrimaryKeyResolver::resolvePrimaryKeyFromUpdatedBy
before deserialization
Added a new constructor argument iterable $updateBy = []
in Shopware\Core\Content\ImportExport\Struct\Config
which will become required starting from v6.5.0
.
The new parameter is used to pass a mapping from an entity to a single field of the corresponding definition. This mapping is then used to resolve the primary key of a data set. This provides an alternative to using IDs for updating existing data sets.
$config = new Config(
[['key' => 'productNumber', 'mappedKey' => 'product_number']],
['sourceEntity' => $sourceEntity]
);
$config = new Config(
[['key' => 'productNumber', 'mappedKey' => 'product_number']],
['sourceEntity' => $sourceEntity],
[['entityName' => ProductDefinition::ENTITY_NAME, 'mappedKey' => 'productNumber']]
);