You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
996B

  1. <?php
  2. namespace Lc\CaracoleBundle\Builder\Order;
  3. use Lc\CaracoleBundle\Model\Order\OrderProductInterface;
  4. use Lc\CaracoleBundle\Resolver\Price\PriceResolver;
  5. class OrderProductBuilder
  6. {
  7. protected PriceResolver $priceResolver;
  8. public function __construct(PriceResolver $priceResolver)
  9. {
  10. $this->priceResolver = $priceResolver;
  11. }
  12. public function init(OrderProductInterface $orderProduct)
  13. {
  14. $orderProduct->setTitle($orderProduct->getTitleOrderShop());
  15. $orderProduct->setPrice($this->priceResolver->getPrice($orderProduct->getProduct()));
  16. $orderProduct->setBuyingPrice($this->priceResolver->getBuyingPrice($orderProduct->getProduct()));
  17. $orderProduct->setUnit($orderProduct->getProduct()->getUnitInherited());
  18. $orderProduct->setTaxRate($orderProduct->getProduct()->getTaxRateInherited());
  19. $orderProduct->setQuantityProduct($orderProduct->getProduct()->getQuantityInherited());
  20. return $orderProduct;
  21. }
  22. }