瀏覽代碼

[Form] Fixed: parent::configure() should always be called after adding options to overrule options in the parent class

Bernhard Schussek 14 年之前
父節點
當前提交
48b3e92504

+ 2 - 2
src/Symfony/Component/Form/InputField.php

@@ -23,9 +23,9 @@ class InputField extends Field
      */
     protected function configure()
     {
-        parent::configure();
-
         $this->addRequiredOption('type');
+
+        parent::configure();
     }
 
     /**

+ 2 - 2
src/Symfony/Component/Form/IntegerField.php

@@ -33,12 +33,12 @@ class IntegerField extends NumberField
      */
     protected function configure()
     {
-        parent::configure();
-
         $this->addOption('precision', 0);
 
         // Integer cast rounds towards 0, so do the same when displaying fractions
         $this->addOption('rounding-mode', NumberToLocalizedStringTransformer::ROUND_DOWN);
+
+        parent::configure();
     }
 
     /**

+ 2 - 2
src/Symfony/Component/Form/NumberField.php

@@ -35,13 +35,13 @@ class NumberField extends InputField
      */
     protected function configure()
     {
-        parent::configure();
-
         // default precision is locale specific (usually around 3)
         $this->addOption('precision');
         $this->addOption('grouping', false);
         $this->addOption('rounding-mode', NumberToLocalizedStringTransformer::ROUND_HALFUP);
 
+        parent::configure();
+
         $this->setValueTransformer(new NumberToLocalizedStringTransformer(array(
             'precision' => $this->getOption('precision'),
             'grouping' => $this->getOption('grouping'),

+ 2 - 2
src/Symfony/Component/Form/PasswordField.php

@@ -23,9 +23,9 @@ class PasswordField extends TextField
      */
     protected function configure()
     {
-        parent::configure();
-
         $this->addOption('always_empty', true);
+
+        parent::configure();
     }
 
     /**

+ 2 - 2
src/Symfony/Component/Form/PercentField.php

@@ -28,11 +28,11 @@ class PercentField extends NumberField
      */
     protected function configure()
     {
-        parent::configure();
-
         $this->addOption('precision', 0);
         $this->addOption('percent_type', self::FRACTIONAL);
 
+        parent::configure();
+
         $this->setValueTransformer(new PercentToLocalizedStringTransformer(array(
             'precision' => $this->getOption('precision'),
             'type' => $this->getOption('percent_type'),

+ 2 - 2
src/Symfony/Component/Form/TextField.php

@@ -33,9 +33,9 @@ class TextField extends InputField
      */
     protected function configure()
     {
-        parent::configure();
-
         $this->addOption('max_length');
+
+        parent::configure();
     }
 
     /**

+ 2 - 2
src/Symfony/Component/Form/ToggleField.php

@@ -25,11 +25,11 @@ abstract class ToggleField extends InputField
      */
     protected function configure()
     {
-        parent::configure();
-
         $this->addOption('value');
         $this->addOption('label');
 
+        parent::configure();
+
         $this->setValueTransformer(new BooleanToStringTransformer());
     }