Skip to content

vendor/magento/framework/Data/Collection.php #33500

Closed
@savandholu

Description

@savandholu

vendor/magento/framework/Data/Collection.php

line : 406

 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;
    }

become => below, wait for M2 fix
public function addItem(\Magento\Framework\DataObject $item)
{
$itemId = $this->_getItemId($item);

    if ($itemId !== null) {
        if (isset($this->_items[$itemId])) {
        return $this;
        }
        $this->_items[$itemId] = $item;
    } else {
        $this->_addItem($item);
    }
    return $this;
}

Originally posted by @smagic39 in #6126 (comment)

Changes file code but it's not working

Metadata

Metadata

Assignees

Labels

Issue: needs updateAdditional information is require, waiting for response

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions