Author: Adam Piotrowski (adam@wellcommerce.org)
Inheritance: extends WellCommerce\Bundle\DoctrineBundle\Entity\AbstractEntity, implements WellCommerce\Bundle\OrderBundle\Entity\OrderProductInterface, use trait WellCommerce\Bundle\DoctrineBundle\Behaviours\Timestampable\TimestampableTrait, use trait WellCommerce\Bundle\ProductBundle\Entity\ProductAwareTrait, use trait WellCommerce\Bundle\ProductBundle\Entity\VariantAwareTrait, use trait OrderAwareTrait
 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;
 }