Created
June 19, 2020 15:58
-
-
Save AurelienLavorel/493e367581b24ed1eb9d88b30c7140e4 to your computer and use it in GitHub Desktop.
Avoid duplicate id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/vendor/magento/framework/Data/AbstractSearchResult.php b/vendor/magento/framework/Data/AbstractSearchResult.php | |
index 05c8e39f524658b559ad7d3df37d598c443c12ef..f28c42cd2751caa14716efffe5a757f9988200f7 100644 | |
--- a/vendor/magento/framework/Data/AbstractSearchResult.php | |
+++ b/vendor/magento/framework/Data/AbstractSearchResult.php | |
@@ -265,11 +265,6 @@ abstract class AbstractSearchResult extends AbstractDataObject implements Search | |
{ | |
$itemId = $this->getItemId($item); | |
if ($itemId !== null) { | |
- if (isset($this->data['items'][$itemId])) { | |
- throw new \Exception( | |
- 'Item (' . get_class($item) . ') with the same ID "' . $item->getId() . '" already exists.' | |
- ); | |
- } | |
$this->data['items'][$itemId] = $item; | |
} else { | |
$this->data['items'][] = $item; | |
diff --git a/vendor/magento/framework/Data/Collection.php b/vendor/magento/framework/Data/Collection.php | |
index 8514d82f6aa7189f5802205db5a9de59b2e8777a..6b982da1dce5c49f63c8985ece121c17399f5c3c 100644 | |
--- a/vendor/magento/framework/Data/Collection.php | |
+++ b/vendor/magento/framework/Data/Collection.php | |
@@ -402,12 +402,6 @@ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, Coll | |
$itemId = $this->_getItemId($item); | |
if ($itemId !== null) { | |
- if (isset($this->_items[$itemId])) { | |
- //phpcs:ignore Magento2.Exceptions.DirectThrow | |
- throw new \Exception( | |
- 'Item (' . get_class($item) . ') with the same ID "' . $item->getId() . '" already exists.' | |
- ); | |
- } | |
$this->_items[$itemId] = $item; | |
} else { | |
$this->_addItem($item); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment