From d61b34de3fbb24dad8e992ec1e3047faeef6ff1e Mon Sep 17 00:00:00 2001 From: Cristoforo Cervino Date: Thu, 29 Apr 2021 14:59:48 +0200 Subject: [PATCH 1/3] fix typo --- src/Form/DataMapper/PeriodDataMapper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Form/DataMapper/PeriodDataMapper.php b/src/Form/DataMapper/PeriodDataMapper.php index 160fd8f..15375fc 100644 --- a/src/Form/DataMapper/PeriodDataMapper.php +++ b/src/Form/DataMapper/PeriodDataMapper.php @@ -126,7 +126,7 @@ public function mapFormsToData(iterable $forms, &$viewData): void if ($startDate instanceof \DateTimeInterface && $endDate instanceof \DateTimeInterface) { if ($startDate > $endDate) { $failure = new TransformationFailedException('Start date should be greater or equals then the end date.'); - $failure->setInvalidMessage('Start date should be greater or equals then the end date', [ + $failure->setInvalidMessage('Start date should be greater or equals then the end date.', [ '{{ startDate }}' => json_encode($startDate), '{{ endDate }}' => json_encode($endDate), ]); From a9902ebb2451502abace3d49cd583091aa7f0170 Mon Sep 17 00:00:00 2001 From: Cristoforo Cervino Date: Thu, 29 Apr 2021 17:50:10 +0200 Subject: [PATCH 2/3] fix translations --- .../translations/AndantePeriodBundle.en.xlf | 20 -------------- .../translations/AndantePeriodBundle.it.xlf | 20 -------------- src/Resources/translations/validators.en.xlf | 27 +++++++++++++++++++ src/Resources/translations/validators.it.xlf | 27 +++++++++++++++++++ 4 files changed, 54 insertions(+), 40 deletions(-) create mode 100644 src/Resources/translations/validators.en.xlf create mode 100644 src/Resources/translations/validators.it.xlf diff --git a/src/Resources/translations/AndantePeriodBundle.en.xlf b/src/Resources/translations/AndantePeriodBundle.en.xlf index 16ec926..146a9ee 100644 --- a/src/Resources/translations/AndantePeriodBundle.en.xlf +++ b/src/Resources/translations/AndantePeriodBundle.en.xlf @@ -30,26 +30,6 @@ Boundary type Boundary type - - Start date should be valid. {{ startDate }} is not a valid date. - La data di inizio dovrebbe essere valida. {{ startDate }} non è una data valida. - - - End date should be valid. {{ endDate }} is not a valid date. - La data di fine dovrebbe essere valida. {{ endDate }} non è una data valida. - - - Start date should be greater or equals then the end date. - La data di inizio dovrebbe essere maggiore o uguale della data di fine. - - - Invalid Period. - Periodo non valido. - - - A valid Period is required. - Un periodo è obbligatorio. - diff --git a/src/Resources/translations/AndantePeriodBundle.it.xlf b/src/Resources/translations/AndantePeriodBundle.it.xlf index f9cf56f..84d72a7 100644 --- a/src/Resources/translations/AndantePeriodBundle.it.xlf +++ b/src/Resources/translations/AndantePeriodBundle.it.xlf @@ -30,26 +30,6 @@ Boundary type Estremità - - Start date should be valid. {{ startDate }} is not a valid date. - Start date should be valid. {{ startDate }} is not a valid date. - - - End date should be valid. {{ endDate }} is not a valid date. - End date should be valid. {{ endDate }} is not a valid date. - - - Start date should be greater or equals then the end date. - Start date should be greater or equals then the end date. - - - Invalid Period. - Invalid Period. - - - A valid Period is required. - A valid Period is required. - diff --git a/src/Resources/translations/validators.en.xlf b/src/Resources/translations/validators.en.xlf new file mode 100644 index 0000000..2f111a5 --- /dev/null +++ b/src/Resources/translations/validators.en.xlf @@ -0,0 +1,27 @@ + + + + + + Start date should be valid. {{ startDate }} is not a valid date. + Start date should be valid. {{ startDate }} is not a valid date. + + + End date should be valid. {{ endDate }} is not a valid date. + End date should be valid. {{ endDate }} is not a valid date. + + + Start date should be greater or equals then the end date. + Start date should be greater or equals then the end date. + + + Invalid Period. + Invalid Period. + + + A valid Period is required. + A valid Period is required. + + + + diff --git a/src/Resources/translations/validators.it.xlf b/src/Resources/translations/validators.it.xlf new file mode 100644 index 0000000..78614e9 --- /dev/null +++ b/src/Resources/translations/validators.it.xlf @@ -0,0 +1,27 @@ + + + + + + Start date should be valid. {{ startDate }} is not a valid date. + La data di inizio dovrebbe essere valida. {{ startDate }} non è una data valida. + + + End date should be valid. {{ endDate }} is not a valid date. + La data di fine dovrebbe essere valida. {{ endDate }} non è una data valida. + + + Start date should be greater or equals then the end date. + La data di inizio dovrebbe essere successiva o uguale della data di fine. + + + Invalid Period. + Periodo non valido. + + + A valid Period is required. + Un periodo è obbligatorio. + + + + From d4dbc96e3a76f5f02ca187c268d851ed58c1d472 Mon Sep 17 00:00:00 2001 From: Cristoforo Cervino Date: Thu, 29 Apr 2021 18:52:57 +0200 Subject: [PATCH 3/3] fix error bubbling --- src/Form/PeriodType.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Form/PeriodType.php b/src/Form/PeriodType.php index 6627681..3f2bdbd 100644 --- a/src/Form/PeriodType.php +++ b/src/Form/PeriodType.php @@ -91,7 +91,8 @@ public function configureOptions(OptionsResolver $resolver): void 'end_date_options' => [], 'boundary_type_child_name' => 'boundary', 'boundary_type_options' => [], - 'allow_null' => true + 'allow_null' => true, + 'error_bubbling' => false ]); $resolver->setAllowedValues('default_boundary_type', [