public function createAndSaveCartCoupon(
        CartInterface $cart,
        CouponInterface $coupon
    ) {
        /**
         * We create a new instance of CartCoupon.
         * We also persist and flush relation.
         */
        $cartCoupon = $this
            ->cartCouponDirector
            ->create();

        $cartCoupon->setCart($cart);
        $cartCoupon->setCoupon($coupon);

        $this
            ->cartCouponDirector
            ->save($cartCoupon);

        return $cartCoupon;
    }
public function createAndSaveCartCoupon(
        CartInterface $cart,
        CouponInterface $coupon
    ) {
        /**
         * We create a new instance of CartCoupon.
         * We also persist and flush relation.
         */
        $cartCoupon = $this
            ->cartCouponDirector
            ->create();

        $cartCoupon->setCart($cart);
        $cartCoupon->setCoupon($coupon);

        $this
            ->cartCouponDirector
            ->save($cartCoupon);

        return $cartCoupon;
    }
public function createAndSaveCartCoupon ( CartInterface $ cart , CouponInterface $ coupon ) { /**
         * We create a new instance of CartCoupon.
         * We also persist and flush relation.
         */ $ cartCoupon = $ this -> cartCouponDirector -> create ( ) ; $ cartCoupon -> setCart ( $ cart ) ; $ cartCoupon -> setCoupon ( $ coupon ) ; $ this -> cartCouponDirector -> save ( $ cartCoupon ) ; return $ cartCoupon ; }
Create a cart coupon given a cart and a coupon.

@param CartInterface   $cart   Cart
@param CouponInterface $coupon Coupon

@return CartCouponInterface Cart Coupon created
Create a cart coupon given a cart and a coupon .