From 989a44591f943d002d82cdfa014346ebe12dbe79 Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Fri, 2 May 2014 16:55:39 +0200 Subject: [PATCH] Added date translator --- core/lib/Thelia/Form/CouponCreationForm.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/core/lib/Thelia/Form/CouponCreationForm.php b/core/lib/Thelia/Form/CouponCreationForm.php index 2e800a882..05acf2c4e 100644 --- a/core/lib/Thelia/Form/CouponCreationForm.php +++ b/core/lib/Thelia/Form/CouponCreationForm.php @@ -16,6 +16,7 @@ use Symfony\Component\Validator\Constraints\Date; use Symfony\Component\Validator\Constraints\GreaterThanOrEqual; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotEqualTo; +use Thelia\Coupon\ExpirationDateTransformer; /** * Allow to build a form Coupon @@ -90,14 +91,16 @@ class CouponCreationForm extends BaseForm array() ) ->add( - 'expirationDate', - 'text', - array( - 'constraints' => array( - new NotBlank(), - new Date() + $this->formBuilder->create( + 'expirationDate', + 'text', + array( + 'constraints' => array( + new NotBlank(), + //new Date() + ) ) - ) + )->addViewTransformer(new ExpirationDateTransformer()) ) ->add( 'isCumulative',