浏览代码

Merge pull request #2422 from Bladrak/fieldoptions_daterange

Updated Date*RangeType filter options
Thomas 10 年之前
父节点
当前提交
55f2846171
共有 3 个文件被更改,包括 7 次插入4 次删除
  1. 3 0
      CHANGELOG.md
  2. 1 1
      Form/Type/Filter/DateRangeType.php
  3. 3 3
      Form/Type/Filter/DateTimeRangeType.php

+ 3 - 0
CHANGELOG.md

@@ -1,6 +1,9 @@
 CHANGELOG
 =========
 
+### 2014-09-19
+ * [BC BREAK] ``field_options`` is now directly given to ``value`` form in ``DateRangeType`` and ``DateTimeRangeType`` filters.
+
 ### 2014-08-08
  * added new form type ``sonata_type_model_autocomplete``
  * changed ``collection`` form type to ``sonata_type_native_collection``

+ 1 - 1
Form/Type/Filter/DateRangeType.php

@@ -52,7 +52,7 @@ class DateRangeType extends AbstractType
 
         $builder
             ->add('type', 'choice', array('choices' => $choices, 'required' => false))
-            ->add('value', $options['field_type'], array('field_options' => $options['field_options']))
+            ->add('value', $options['field_type'], $options['field_options'])
         ;
     }
 

+ 3 - 3
Form/Type/Filter/DateTimeRangeType.php

@@ -46,13 +46,13 @@ class DateTimeRangeType extends AbstractType
     public function buildForm(FormBuilderInterface $builder, array $options)
     {
         $choices = array(
-            self::TYPE_BETWEEN    => $this->translator->trans('label_date_type_between', array(), 'SonataAdminBundle'),
-            self::TYPE_NOT_BETWEEN    => $this->translator->trans('label_date_type_not_between', array(), 'SonataAdminBundle'),
+            self::TYPE_BETWEEN     => $this->translator->trans('label_date_type_between', array(), 'SonataAdminBundle'),
+            self::TYPE_NOT_BETWEEN => $this->translator->trans('label_date_type_not_between', array(), 'SonataAdminBundle'),
         );
 
         $builder
             ->add('type', 'choice', array('choices' => $choices, 'required' => false))
-            ->add('value', $options['field_type'], array('field_options' => $options['field_options']))
+            ->add('value', $options['field_type'], $options['field_options'])
         ;
     }