Browse Source

[Form] Add new fields in CollectionField::setData()

Jeremy Mikola 14 years ago
parent
commit
77602239a4
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/Symfony/Component/Form/CollectionField.php

+ 4 - 0
src/Symfony/Component/Form/CollectionField.php

@@ -61,6 +61,10 @@ class CollectionField extends FieldGroup
             }
         }
 
+        foreach ($collection as $name => $value) {
+            $this->add($this->newField($name, $name));
+        }
+
         parent::setData($collection);
     }