Kaynağa Gözat

Fix #147 - accept empty array as value

Thomas Rabaix 14 yıl önce
ebeveyn
işleme
d5473135e0

+ 1 - 1
Form/ChoiceList/ModelChoiceList.php

@@ -111,7 +111,7 @@ class ModelChoiceList extends ArrayChoiceList
     {
         parent::load();
 
-        if ($this->choices) {
+        if (is_array($this->choices)) {
             $entities = $this->choices;
         } else if ($this->query) {
             $entities = $this->modelManager->executeQuery($this->query);

+ 1 - 1
Form/Type/ModelType.php

@@ -45,7 +45,7 @@ class ModelType extends AbstractType
             'class'             => null,
             'property'          => null,
             'query'             => null,
-            'choices'           => array(),
+            'choices'           => null,
             'parent'            => 'choice',
             'preferred_choices' => array(),
             'field_description' => false,