diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index b8126a5d8cd8b..73f7fe0d73421 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -1533,4 +1533,38 @@ public function getLoadedIds() { return array_keys($this->_items); } + + /** + * Clear collection + * @return \Magento\Eav\Model\Entity\Collection\AbstractCollection + */ + public function clear() + { + $this->_itemsById = array(); + return parent::clear(); + } + + /** + * Remove all items from collection + * @return \Magento\Eav\Model\Entity\Collection\AbstractCollection + */ + public function removeAllItems() + { + $this->_itemsById = array(); + return parent::removeAllItems(); + } + + /** + * Remove item from collection by item key + * + * @param mixed $key + * @return \Magento\Eav\Model\Entity\Collection\AbstractCollection + */ + public function removeItemByKey($key) + { + if (isset($this->_items[$key])) { + unset($this->_itemsById[$this->_items[$key]->getId()]); + } + return parent::removeItemByKey($key); + } }