Skip to content

Commit

Permalink
KVSA1-46: Category tree update is slow
Browse files Browse the repository at this point in the history
  • Loading branch information
dxops committed Apr 3, 2020
1 parent 678392b commit 8611e90
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
16 changes: 16 additions & 0 deletions ImportExport/Strategy/CategoryImportStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,22 @@ protected function updateContextCounters($entity)
}
}

protected function isFieldExcluded($entityName, $fieldName, $itemData = null)
{
$excludeCategoryFields = [
'childCategories',
'slugs',
'slugPrototypes',
'slugPrototypesWithRedirect',
];

if (is_a($entityName, Category::class, true) && in_array($fieldName, $excludeCategoryFields)) {
return true;
}

return parent::isFieldExcluded($entityName, $fieldName, $itemData);
}

protected function mapCollections(Collection $importedCollection, Collection $sourceCollection)
{
}
Expand Down
14 changes: 10 additions & 4 deletions ImportExport/Strategy/ProductImportStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,16 @@ protected function updateContextCounters($entity)

protected function isFieldExcluded($entityName, $fieldName, $itemData = null)
{
if (
is_a($entityName, Product::class, true)
&& in_array($fieldName, ['variantLinks', 'parentVariantLinks', 'images'])
) {
$excludeProductFields = [
'variantLinks',
'parentVariantLinks',
'images',
'slugs',
'slugPrototypes',
'slugPrototypesWithRedirect',
];

if (is_a($entityName, Product::class, true) && in_array($fieldName, $excludeProductFields)) {
return true;
}

Expand Down

0 comments on commit 8611e90

Please sign in to comment.