浏览代码

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

Bernhard Schussek 14 年之前
父节点
当前提交
d58c610833
共有 1 个文件被更改,包括 4 次插入4 次删除
  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;
     }