Skip to content

Commit

Permalink
Optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
kenza-ya committed May 14, 2024
1 parent fd96930 commit 1e667ce
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Version 26.1.2

## Bugfixes

* Optimize the code logic to get PrimarySku with PkMapping

# Version 26.1.1

## Bugfixes
Expand Down
13 changes: 12 additions & 1 deletion src/Observers/EeProductObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,22 @@ protected function mergeEntity(array $entity, array $attr, $changeSetName = null
$this->setLastRowId($entity[MemberNames::ROW_ID]);
$this->setLastEntityId($entity[MemberNames::ENTITY_ID]);

$this->addPrimarySkuToRowPkMapping($entity[MemberNames::SKU], $entity[MemberNames::ROW_ID]);
// merge and return the entity
return parent::mergeEntity($entity, $attr, $changeSetName);
}

/**
* mapping the sku with row_id
*
* @return void
*/
protected function savePrimarySkuMapping()
{
$this->addPrimarySkuToRowPkMapping(
$this->getValue(ColumnKeys::SKU),
isset($product[MemberNames::ROW_ID]) ? $product[MemberNames::ROW_ID] : $this->getSubject()->getLastRowId()
);
}
/**
* Initialize the product with the passed attributes and returns an instance.
*
Expand Down

0 comments on commit 1e667ce

Please sign in to comment.