8000 bug #36083 [DI][Form] Fixed test suite (TimeType changes & unresolved… · symfony/symfony@cc8d23a · GitHub
[go: up one dir, main page]

Skip to content

Commit cc8d23a

Browse files
committed
bug #36083 [DI][Form] Fixed test suite (TimeType changes & unresolved merge conflict) (wouterj)
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [DI][Form] Fixed test suite (TimeType changes & unresolved merge conflict) | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - After the merge of #36020 , the `addViewTransformer()` was moved to the top of the statement. This is wrong, as the `$format` variable is changed when a `reference_date` is set (see line 77). This broke Symfony's testsuite :) Commits ------- 18f5b17 [DI][Form] Fixed test suite (TimeType changes & unresolved merge conflict)
2 parents 31fe1ef + 18f5b17 commit cc8d23a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Form/Extension/Core/Type/TimeType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
6060
}
6161

6262
if ('single_text' === $options['widget']) {
63-
$builder->addViewTransformer(new DateTimeToStringTransformer($options['model_timezone'], $options['view_timezone'], $format));
64-
6563
$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $e) use ($options) {
6664
$data = $e->getData();
6765
if ($data && preg_match('/^(?P<hours>\d{2}):(?P<minutes>\d{2})(?::(?P<seconds>\d{2})(?:\.\d+)?)?$/', $data, $matches)) {
@@ -86,6 +84,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
8684
}
8785
});
8886
}
87+
88+
$builder->addViewTransformer(new DateTimeToStringTransformer($options['model_timezone'], $options['view_timezone'], $format));
8989
} else {
9090
$hourOptions = $minuteOptions = $secondOptions = [
9191
'error_bubbling' => true,

0 commit comments

Comments
 (0)
0