public function checkDuplicateCouponCode($value, ExecutionContextInterface $context)
    {
        $exists = CouponQuery::create()->filterByCode($value)->count() > 0;

        if ($exists) {
            $context->addViolation(
                Translator::getInstance()->trans(
                    "The coupon code '%code' already exists. Please choose another coupon code",
                    ['%code' => $value]
                )
            );
        }
    }
public function checkDuplicateCouponCode($value, ExecutionContextInterface $context)
    {
        $exists = CouponQuery::create()->filterByCode($value)->count() > 0;

        if ($exists) {
            $context->addViolation(
                Translator::getInstance()->trans(
                    "The coupon code '%code' already exists. Please choose another coupon code",
                    ['%code' => $value]
                )
            );
        }
    }
public function checkDuplicateCouponCode ( $ value , ExecutionContextInterface $ context ) { $ exists = CouponQuery :: create ( ) -> filterByCode ( $ value ) -> count ( ) > 0 ; if ( $ exists ) { $ context -> addViolation ( Translator :: getInstance ( ) -> trans ( "The coupon code '%code' already exists. Please choose another coupon code" , [ '%code' => $ value ] ) ) ; } }
Check coupon code unicity

@param string                    $value
@param ExecutionContextInterface $context
Check coupon code unicity