Browse Source

#784 : Fix the BC Break on the form default options on the Equal Type

Baptiste "Talus" Clavie 13 years ago
parent
commit
cebd947ae4
1 changed files with 11 additions and 9 deletions
  1. 11 9
      Form/Type/EqualType.php

+ 11 - 9
Form/Type/EqualType.php

@@ -14,6 +14,8 @@ namespace Sonata\AdminBundle\Form\Type;
 use Symfony\Component\Form\Extension\Core\Type\ChoiceType as FormChoiceType;
 use Symfony\Component\Form\Extension\Core\Type\ChoiceType as FormChoiceType;
 use Symfony\Component\Translation\TranslatorInterface;
 use Symfony\Component\Translation\TranslatorInterface;
 
 
+use Symfony\Component\OptionsResolver\OptionsResolverInterface;
+
 class EqualType extends FormChoiceType
 class EqualType extends FormChoiceType
 {
 {
     const TYPE_IS_EQUAL = 1;
     const TYPE_IS_EQUAL = 1;
@@ -33,15 +35,15 @@ class EqualType extends FormChoiceType
     /**
     /**
      * {@inheritDoc}
      * {@inheritDoc}
      */
      */
-    public function getDefaultOptions()
+    public function setDefaultOptions(OptionsResolverInterface $resolver)
     {
     {
-        $options = parent::getDefaultOptions();
-
-        $options['choices'] = array(
-            self::TYPE_IS_EQUAL     => $this->translator->trans('label_type_equals', array(), 'SonataAdminBundle'),
-            self::TYPE_IS_NOT_EQUAL => $this->translator->trans('label_type_not_equals', array(), 'SonataAdminBundle'),
-        );
-
-        return $options;
+        parent::setDefaultOptions($resolver);
+
+        $resolver->setDefaults(array(
+            'choices' => array(
+                self::TYPE_IS_EQUAL     => $this->translator->trans('label_type_equals', array(), 'SonataAdminBundle'),
+                self::TYPE_IS_NOT_EQUAL => $this->translator->trans('label_type_not_equals', array(), 'SonataAdminBundle'),
+            )
+        ));
     }
     }
 }
 }