public function create() : OrderProductInterface { $orderProduct = new OrderProduct(); $orderProduct->setQuantity(1); $orderProduct->setWeight(0); $orderProduct->setBuyPrice(new Price()); $orderProduct->setSellPrice(new DiscountablePrice()); $orderProduct->setCreatedAt(new \DateTime()); $orderProduct->setUpdatedAt(new \DateTime()); $orderProduct->setOptions([]); return $orderProduct; }
/** * {@inheritdoc} */ public function createFromCartProduct(CartProductInterface $cartProduct) { $orderProduct = new OrderProduct(); $product = $cartProduct->getProduct(); $attribute = $cartProduct->getAttribute(); $orderProduct->setProductAttribute($attribute); $orderProduct->setProduct($product); $orderProduct->setSellPrice($cartProduct->getSellPrice()); $orderProduct->setBuyPrice($product->getBuyPrice()); $orderProduct->setQuantity($cartProduct->getQuantity()); $orderProduct->setWeight($cartProduct->getWeight()); return $orderProduct; }