Set supplier of an item.

@param ApiItemInterface $item
@param ProductInterface $product
765728
protected function setItemSupplier(ApiItemInterface $item, ProductInterface $product)
    {
        $supplier = null;
        $supplierName = '';
        // Get products supplier.
        if ($product->getSupplier()) {
            $supplier = $product->getSupplier();
            $supplierName = $product->getSupplier()->getName();
        }
        $item->setSupplier($supplier);
        $item->setSupplierName($supplierName);
    }
879206
private function addAllCurrencies(ProductInterface $product)
    {
        $currencies = $this->currencyRepository->findAll();

        foreach ($product->getPrices() as $price) {
            if (($key = array_search($price->getCurrency(), $currencies)) !== false) {
                unset($currencies[$key]);
            }
        }

        foreach ($currencies as $currency) {
            $price = new ProductPriceEntity();
            $price->setCurrency($currency);

            $product->addPrice($price);
            $price->setProduct($product);
        }
    }
790954
public function setParent(Product $parent = null)
    {
        if ($parent != null) {
            $this->entity->setParent($parent->getEntity());
        } else {
            $this->entity->setParent(null);
        }
    }
597969
public function setItem(\Wucdbm\Bundle\MenuBuilderBundle\Entity\MenuItem $item) {
        $this->item = $item;

        return $this;
    }
1315649
public function setProductWarehouseStockAction(InventoryItem $item)
    {
        $em = $this->getDoctrine()->getManager();
        /* @var WarehouseProductService $warehouseProductService */
        $warehouseProductService = $this->get('flower.stock.service.warehouse_product');
        $warehouseProduct = $warehouseProductService->getByWarehouseProduct($item->getInventory()->getWarehouse(), $item->getProduct());
        $item->setStock($warehouseProduct->getStock());
        $em->flush();
        return $this->redirect($this->generateUrl('stock_inventory_show', array('id' => $item->getInventory()->getId())));
    }
564496
public function setPrice( MShop_Price_Item_Interface $price )
	{
		if ( $price === $this->_price ) { return; }

		$this->_price = $price;
		$this->setModified();
	}
303972
public void setProduct(OperaProduct product) {
    options.get(PRODUCT).setValue(product);

    // Switch context of arguments
    OperaArguments arguments;

    if (getProduct().is(OperaProduct.DESKTOP)) {
      arguments = new OperaDesktopArguments();
    } else {
      arguments = new OperaCoreArguments();
    }

    options.get(ARGUMENTS).setValue(arguments.merge(arguments()));
  }
719113
public function add($name, ItemInterface $item)
    {
        if (isset($this->relationships[$name]) === false) {
            $this->relationships[$name] = [];
        }

        unset($this->relationships[$name][$item->getId()]);

        $this->relationships[$name][$item->getId()] = $item;
    }
1202397
public function setProductOption(\Dywee\ProductBundle\Entity\ProductOption $productOption)
    {
        $this->productOption = $productOption;

        return $this;
    }
1200790
public function set(CacheableInterface $item)
    {
        $this->provider->save($item->getHashKey(), $item->getDataForCache(), $item->getTtl());
    }
848428
public function set(array $adapters, CacheableInterface $item)
    {
        foreach ($adapters as $adapter) {
            $adapter->set($item);
        }
    }
1135232
public function cache(CacheItemInterface $item)
    {
        $content = $this->execute();
        $item->set($content);

        return $item;
    }
274558
public function setShipment(ShipmentInterface $shipment = null)
    {
        $shipment->setOrder($this);
        $this->shipment = $shipment;

        return $this;
    }
1279816
private function updatePrices(ApiItemInterface $item, $data)
    {
        //TODO: currency
        $currency = null;

        // set products price by data
        if ($item->getUseProductsPrice() === false) {
            $item->setPrice($this->getProperty($data, 'price', $item->getPrice()));
        }

        // set items total net price
        $price = $this->itemPriceCalculator->calculate($item, $currency, $item->getUseProductsPrice());
        $item->setTotalNetPrice($price);

        // set items price
        $itemPrice = $this->itemPriceCalculator->getItemPrice($item, $currency, $item->getUseProductsPrice());
        $item->setPrice($itemPrice);
    }
183897
public function save(CacheItemInterface $item)
    {
        $this->cache->set($item->getKey(), $item);
        return $this->commit();
    }
65085
protected function setItemByProductData($productData, ApiItemInterface $item, $locale)
    {
        $productId = $this->getProductId($productData, 'product.id');

        /** @var Product $product */
        $product = $this->productRepository->find($productId);
        if (!$product) {
            throw new ProductNotFoundException(self::$productEntityName, $productId);
        }
        $item->setProduct($product);
        $translation = $product->getTranslation($locale);

        // When the product is not available in the current language choose the first translation you find.
        if (is_null($translation)) {
            if (count($product->getTranslations()) > 0) {
                $translation = $product->getTranslations()[0];
            } else {
                throw new ProductException('Product ' . $product->getId() . ' has no translations!');
            }
        }

        $this->setItemSupplier($item, $product);

        $item->setName($translation->getName());
        $item->setDescription($translation->getLongDescription());
        $item->setNumber($product->getNumber());

        // set order unit
        if ($product->getOrderUnit()) {
            $item->setQuantityUnit($product->getOrderUnit()->getTranslation($locale)->getName());
        } else if ($product->getParent() && $product->getParent()->getOrderUnit()) {
            $item->setQuantityUnit($product->getParent()->getOrderUnit()->getTranslation($locale)->getName());
        }

        $item->setIsRecurringPrice($product->isRecurringPrice());

        $taxClass = $product->getTaxClass();

        /*
         * If the product doesn't have a taxClass but has a parent, we try to get the taxClass from the parent.
         * This is used for product variants, which get the taxClass from the original product.
         */
        if (!$taxClass && $product->getParent()) {
            $taxClass = $product->getParent()->getTaxClass();
        }

        if ($taxClass) {
            $tax = $this->retrieveTaxForClass($taxClass);
            $item->setTax($tax);
        } else {
            $item->setTax(0);
        }

        return $product;
    }
1264634
public function setItem(Item $item)
    {
        if ($this->item !== $item) {
            $this->item = $item->setType($this);
        }

        return $this;
    }