OrderReductionCartFactory.php 1.3KB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Lc\CaracoleBundle\Factory\Order;
  3. use App\Entity\Order\OrderReductionCart;
  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. $orderReductionCart = new OrderReductionCart();
  14. $orderReductionCart->setOrderShop($orderShop);
  15. $orderReductionCart->setReductionCart($reductionCart);
  16. $orderReductionCart->setTitle($reductionCart->getTitle());
  17. $orderReductionCart->setValue($reductionCart->getValue());
  18. $orderReductionCart->setUnit($reductionCart->getUnit());
  19. $orderReductionCart->setBehaviorTaxRate($reductionCart->getBehaviorTaxRate());
  20. $orderReductionCart->setFreeShipping($reductionCart->getFreeShipping());
  21. $orderReductionCart->setAppliedTo($reductionCart->getAppliedTo());
  22. $orderReductionCart->setType($reductionCart->getType());
  23. $orderReductionCart->setCodeUsed($code);
  24. return $orderReductionCart;
  25. }
  26. }