|
21 | 21 | use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
|
22 | 22 | use Symfony\Component\Form\FormView;
|
23 | 23 | use Symfony\Component\OptionsResolver\Options;
|
24 |
| -use Symfony\Component\OptionsResolver\OptionsResolver; |
| 24 | +use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
25 | 25 |
|
26 | 26 | class TimeType extends AbstractType
|
27 | 27 | {
|
@@ -157,7 +157,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
|
157 | 157 | /**
|
158 | 158 | * {@inheritdoc}
|
159 | 159 | */
|
160 |
| - public function configureOptions(OptionsResolver $resolver) |
| 160 | + public function setDefaultOptions(OptionsResolverInterface $resolver) |
161 | 161 | {
|
162 | 162 | $compound = function (Options $options) {
|
163 | 163 | return $options['widget'] !== 'single_text';
|
@@ -214,24 +214,31 @@ public function configureOptions(OptionsResolver $resolver)
|
214 | 214 | 'compound' => $compound,
|
215 | 215 | ));
|
216 | 216 |
|
217 |
| - $resolver->setNormalizer('empty_value', $placeholderNormalizer); |
218 |
| - $resolver->setNormalizer('placeholder', $placeholderNormalizer); |
219 |
| - |
220 |
| - $resolver->setAllowedValues('input', array( |
221 |
| - 'datetime', |
222 |
| - 'string', |
223 |
| - 'timestamp', |
224 |
| - 'array', |
| 217 | + $resolver->setNormalizers(array( |
| 218 | + 'empty_value' => $placeholderNormalizer, |
| 219 | + 'placeholder' => $placeholderNormalizer, |
225 | 220 | ));
|
226 |
| - $resolver->setAllowedValues('widget', array( |
227 |
| - 'single_text', |
228 |
| - 'text', |
229 |
| - 'choice', |
| 221 | + |
| 222 | + $resolver->setAllowedValues(array( |
| 223 | + 'input' => array( |
| 224 | + 'datetime', |
| 225 | + 'string', |
| 226 | + 'timestamp', |
| 227 | + 'array', |
| 228 | + ), |
| 229 | + 'widget' => array( |
| 230 | + 'single_text', |
| 231 | + 'text', |
| 232 | + 'choice', |
| 233 | + ), |
230 | 234 | ));
|
231 | 235 |
|
232 |
| - $resolver->setAllowedTypes('hours', 'array'); |
233 |
| - $resolver->setAllowedTypes('minutes', 'array'); |
234 |
| - $resolver->setAllowedTypes('seconds', 'array'); |
| 236 | + $resolver->setAllowedTypes(array( |
| 237 | + 'hours' => 'array', |
| 238 | + 'minutes' => 'array', |
| 239 | + 'seconds' => 'array', |
| 240 | + 'empty_value' => array('string', 'boolean', 'null'), |
| 241 | + )); |
235 | 242 | }
|
236 | 243 |
|
237 | 244 | /**
|
|
0 commit comments