Add item

@param OrderItem $item

@return ProductPurchase
514876
public function addItem(ProductPurchase $item)
    {
        $item->setTransaction($this);
        $this->items->add($item);

        return $this;
    }
585688
public function addItem($item)
	{
		if( ! $item instanceof Model )
		{
			$item = new $this->defaultModel($item);
		}

		$this->data[] = $item;
	}
1275903
public function addBuyable(Buyable $item, $qty = 1, array $options = [])
    {
        $cartItem = CartItem::fromBuyable($item, $options);

        return $this->addItemToCart($cartItem, $qty);
    }
11287
public function &addItem(MenuItem $menu_item)
    {
        $this->items[$menu_item->getName()] = $menu_item;

        return $this->items[$menu_item->getName()];
    }
1192150
public function add($item)
    {
        if (is_array($item)) {
            foreach ($item as $element) {
                $this->add($element);
            }
        } else if (! $this->contains($item->path())) {
            $this->items[$item->path()] = [
                'instance' => $item,
                'listener_index' => $item->addPathListener([$this, 'updatePath'])
            ];
        }
        return $this;
    }
802443
public function setDiscountOnItem(CartItem $item)
    {
        $this->appliedToCart = false;
        $item->code = $this->code;
        $item->coupon = $this;
    }
780960
public function addItem(Item $item)
    {
        if (!$this->items->contains($item)) {
            $this->items->add($item);
            $item->addGenre($this);
        }

        return $this;
    }
650580
public function add( $item, &$success = null ) {

			$result = $this->fire( 'before-add', $item );

			if ( !$result->isPropagationStopped() ) {

				$this->items[] = $this->decorate( $item );
				$this->len++;

				$this->fire( 'add', $item );

				$success = true;

			} else {

				$success = false;

			}

			return $this;

		}
1363666
public function add(MenuItem $item)
    {
        $this->collection[$this->count] = $item;
        $this->names[$item->getName()]  = $this->count;

        $this->count++;

        return $this;
    }
63990
public function removeItem(Item $item)
    {
        if ($this->items->contains($item)) {
            $this->items->removeElement($item);
            $item->setType(null);
        }

        return $this;
    }
227074
public function setItem(Item $item = null)
    {
        if ($this->item !== $item) {
            // romove link on this item for old item
            if ($this->item instanceof Item) {
                $tmp = $this->item;
                $this->item = null;
                $tmp->removeSource($this);
            }
            $this->item = $item;
            // add link on this item
            if ($item instanceof Item) {
                $this->item->addSource($this);
            }
        }

        return $this;
    }
440935
protected function setItemSupplier($item, $product)
    {
        // get products supplier
        if ($product->getSupplier()) {
            $item->setSupplier($product->getSupplier());
            $item->setSupplierName($product->getSupplier()->getName());
        } else {
            $item->setSupplier(null);
            $item->setSupplierName('');
        }
    }
735810
protected function addItem($item, $options = [])
    {
        $nextTo = array_get($options, 'next_to');
        $position = false;
        foreach ($this->items as $index => $m) {
            if ($m['id'] == $nextTo) {
                $position = $index;
            }
        }

        $newMenu = [
            'item'      => $item,
            'before'    => array_get($options, 'before', ''),
            'after'     => array_get($options, 'after', ''),
            'url_def'   => array_get($options, 'url_def'),
            'is_active' => array_get($options, 'is_active'),
            'id'        => array_get($options, 'id'),
        ];

        if ($position !== false) {
            array_splice($this->items, $position + 1, 0, [$newMenu]);
        } else {
            $this->items[] = $newMenu;
        }

        return $this;
    }
661518
public function setItem(Item $item = null)
    {
        if ($this->item !== $item) {
            // romove link on this item for old item
            if ($this->item instanceof Item) {
                $tmp = $this->item;
                $this->item = null;
                $tmp->removeImage($this);
            }
            $this->item = $item;
            // add link on this item
            if ($item instanceof Item) {
                $this->item->addImage($this);
            }
        }

        return $this;
    }
1196562
private function addItem(Item $item)
    {
        $em = $this->getDoctrine()->getManager();
        $em->persist($item);
        $em->flush();

        return $this->redirect($this->generateUrl(
            'item_show',
            ['id' => $item->getId(), 'name' => $item->getUrlName()]
        ));
    }
1170428
public function add(PriorityQueueItem $item) {
        $priority = $item->getPriority();
        if (!isset($this->items[$priority])) {
            $this->items[$priority] = array($item);
        } else {
            $this->items[$priority][] = $item;
        }
        return $this;
    }
455417
public function addItem(GridItem $item, $order = null)
    {
        if (empty($this->getItem($item->getUuid()))) {
            $rowItem = new GridRowItem();
            $rowItem->setOrder(isset($order) || 0 === $order ? $order : $this->rowItems->count());
            $rowItem->setRow($this);
            $rowItem->setItem($item);

            $this->rowItems->add($rowItem);
        }
    }