Exemplo n.º 1
0
 /**
  * Purge existing OrderCoupons
  *
  * @param OrderInterface $order Order where to delete all coupons
  *
  * @return $this Self object
  */
 public function truncateOrderCoupons(OrderInterface $order)
 {
     $orderCoupons = $this->orderCouponRepository->findOrderCouponsByOrder($order);
     if ($orderCoupons instanceof Collection) {
         foreach ($orderCoupons as $orderCoupon) {
             $this->orderCouponObjectManager->remove($orderCoupon);
         }
         $this->orderCouponObjectManager->flush($orderCoupons->toArray());
     }
     return $this;
 }