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;
    }
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;
    }
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 ; }
Purge existing OrderCoupons.

@param OrderInterface $order Order where to delete all coupons

@return $this Self object
Purge existing OrderCoupons .