Skip to content

Commit

Permalink
AKM-24: Connector fails because of invalid entities
Browse files Browse the repository at this point in the history
  • Loading branch information
dxops committed Jul 8, 2021
1 parent d1d8f29 commit 875202a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ImportExport/Strategy/StrategyRelationsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,10 @@ protected function updateRelations($entity, array $itemData = null)
true
);

$key = $relationCollection->indexOf($collectionEntity);
$relationCollection->removeElement($collectionEntity);
if ($existingCollectionEntity) {
if (!$relationCollection->contains($existingCollectionEntity)) {
$relationCollection->removeElement($collectionEntity);
$relationCollection->add($existingCollectionEntity);
}

$relationCollection->set($key, $existingCollectionEntity);
$this->cacheInverseFieldRelation($entityName, $fieldName, $existingCollectionEntity);
}
}
Expand Down

0 comments on commit 875202a

Please sign in to comment.