Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Form/Type/CouponType.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function __construct(CouponRepository $couponRepository, ValidatorInterfa
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$max = 9999999999;
$currency = $this->container->getParameter('currency');
$builder
->add('coupon_cd', TextType::class, [
Expand All @@ -85,6 +86,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'constraints' => [
new Assert\NotBlank(),
new Assert\Regex(['pattern' => '/^[a-zA-Z0-9]+$/i']),
new Assert\Length([
'max' => 20,
]),
],
])
->add('coupon_name', TextType::class, [
Expand All @@ -93,6 +97,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'trim' => true,
'constraints' => [
new Assert\NotBlank(),
new Assert\Length([
'max' => 50,
]),
],
])
->add('coupon_type', ChoiceType::class, [
Expand Down Expand Up @@ -142,6 +149,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'constraints' => [
new Assert\Range([
'min' => 0,
'max'=> $max,
]),
],
])
Expand All @@ -152,6 +160,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'constraints' => [
new Assert\Range([
'min' => 0,
'max' => $max,
]),
],
])
Expand All @@ -173,6 +182,10 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'widget' => 'single_text',
'constraints' => [
new Assert\NotBlank(),
new Assert\Range([
'min'=> '0003-01-01',
'minMessage' => 'form_error.out_of_range',
]),
],
])
// 有効期間(TO)
Expand All @@ -183,6 +196,10 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'widget' => 'single_text',
'constraints' => [
new Assert\NotBlank(),
new Assert\Range([
'min'=> '0003-01-01',
'minMessage' => 'form_error.out_of_range',
]),
],
])
->add('coupon_release', IntegerType::class, [
Expand Down