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.

34 lines
1.4KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Factory\Order;
  3. use Lc\CaracoleBundle\Container\Order\OrderReductionCartContainer;
  4. use Lc\CaracoleBundle\Model\Order\OrderReductionCartInterface;
  5. use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
  6. use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface;
  7. use Lc\SovBundle\Factory\AbstractFactory;
  8. class OrderReductionCartFactory extends AbstractFactory
  9. {
  10. // createOrderReductionCart
  11. public function create(OrderShopInterface $orderShop, ReductionCartInterface $reductionCart, $code = null): OrderReductionCartInterface
  12. {
  13. $class = OrderReductionCartContainer::getEntityFqcn();
  14. $orderReductionCart = new $class;
  15. $orderReductionCart->setOrderShop($orderShop);
  16. $orderReductionCart->setReductionCart($reductionCart);
  17. $orderReductionCart->setTitle($reductionCart->getTitle());
  18. $orderReductionCart->setValue($reductionCart->getValue());
  19. $orderReductionCart->setUnit($reductionCart->getUnit());
  20. $orderReductionCart->setBehaviorTaxRate($reductionCart->getBehaviorTaxRate());
  21. $orderReductionCart->setFreeShipping($reductionCart->getFreeShipping());
  22. $orderReductionCart->setAppliedTo($reductionCart->getAppliedTo());
  23. $orderReductionCart->setType($reductionCart->getType());
  24. $orderReductionCart->setCodeUsed($code);
  25. return $orderReductionCart;
  26. }
  27. }