setBuyPrice() public method

public setBuyPrice ( WellCommerce\Bundle\AppBundle\Entity\PriceInterface $buyPrice )
$buyPrice WellCommerce\Bundle\AppBundle\Entity\PriceInterface
 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;
 }
Ejemplo n.º 2
0
 /**
  * {@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;
 }