I have this error,
1 exception(s):
Exception #0 (Exception): Item (Magento\Eav\Model\Entity\Attribute) with the same ID "87" already exists.
it seems to me that there must be a duplicate row ?
But what Table as I cant find one.
Thanks.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI have this error,
1 exception(s):
Exception #0 (Exception): Item (Magento\Eav\Model\Entity\Attribute) with the same ID "87" already exists.
it seems to me that there must be a duplicate row ?
But what Table as I cant find one.
Thanks.
Some migration or system that populates the database which caused the duplication of IDs. Magento core predicts a data created by its self, so this kind of error could be solved without stopping the system but it was not implemented yet (e.g. Github issue in the reference session).
Solution
// file: vendor/magento/framework/Data/Collection.php
public function addItem(\Magento\Framework\DataObject $item)
{
$itemId = $this->_getItemId($item);
if ($itemId !== null) {
// if (isset($this->_items[$itemId])) {
// throw new \Exception(
// 'Item (' . get_class($item) . ') with the same ID "' . $item->getId() . '" already exists.'
// );
// }
$this->_items[$itemId] = $item;
} else {
$this->_addItem($item);
}
return $this;
}