/** * @param ProductInterface|ApiProductInterface $product * * @return Item */ public function setProduct($product) { $productEntity = $product; // if api-product - temporarily save if ($product instanceof ApiProductInterface) { $this->tempProduct = $product; $productEntity = $product->getEntity(); } $this->entity->setProduct($productEntity); return $this; }
/** * Set supplier of an item. * * @param ApiItemInterface $item * @param ProductInterface $product */ 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); }