Procházet zdrojové kódy

[Form] Revert changes impacting perfomance and readability

Victor Berchet před 14 roky
rodič
revize
07fa82dff1

+ 6 - 1
src/Symfony/Component/Form/Extension/Core/Type/FieldType.php

@@ -75,6 +75,11 @@ class FieldType extends AbstractType
             $fullName = $name;
         }
 
+        $types = array();
+        foreach ($form->getTypes() as $type) {
+            $types[] = $type->getName();
+        }
+
         $view
             ->set('form', $view)
             ->set('id', $id)
@@ -90,7 +95,7 @@ class FieldType extends AbstractType
             ->set('label', $form->getAttribute('label'))
             ->set('multipart', false)
             ->set('attr', array())
-            ->set('types', array_map(function ($type) { return $type->getName(); }, $form->getTypes()))
+            ->set('types', $types)
         ;
     }
 

+ 5 - 1
src/Symfony/Component/Form/Form.php

@@ -916,7 +916,11 @@ class Form implements \IteratorAggregate, FormInterface
             }
         }
 
-        $childViews = array_map(function ($child) use ($view) { return $child->createView($view); }, $this->children);
+        $childViews = array();
+
+        foreach ($this->children as $key => $child) {
+            $childViews[$key] = $child->createView($view);
+        }
 
         if (null !== $prototype = $view->get('prototype')) {
             $protoView = $prototype->getForm()->createView($view);