Browse Source

[Form] Improved the way passed data is handled in FormFactory

Bernhard Schussek 14 years ago
parent
commit
d58c610833
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/Symfony/Component/Form/FormFactory.php

+ 4 - 4
src/Symfony/Component/Form/FormFactory.php

@@ -123,6 +123,10 @@ class FormFactory implements FormFactoryInterface
         $knownOptions = array();
         $passedOptions = array_keys($options);
 
+        if (!array_key_exists('data', $options)) {
+            $options['data'] = $data;
+        }
+
         while (null !== $type) {
             $type = $this->getType($type);
 
@@ -160,10 +164,6 @@ class FormFactory implements FormFactoryInterface
             }
         }
 
-        if (null !== $data) {
-            $builder->setData($data);
-        }
-
         return $builder;
     }