Explorar o código

Merge pull request #3514 from qsomazzi/fix_sonata_model

Add count check to sonata_type_model
Thomas %!s(int64=9) %!d(string=hai) anos
pai
achega
2e68c08ed1
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      Form/ChoiceList/ModelChoiceLoader.php

+ 1 - 1
Form/ChoiceList/ModelChoiceLoader.php

@@ -79,7 +79,7 @@ class ModelChoiceLoader implements ChoiceLoaderInterface
         if (!$this->choiceList) {
         if (!$this->choiceList) {
             if ($this->query) {
             if ($this->query) {
                 $entities = $this->modelManager->executeQuery($this->query);
                 $entities = $this->modelManager->executeQuery($this->query);
-            } elseif (is_array($this->choices)) {
+            } elseif (is_array($this->choices) && count($this->choices) > 0) {
                 $entities = $this->choices;
                 $entities = $this->choices;
             } else {
             } else {
                 $entities = $this->modelManager->findBy($this->class);
                 $entities = $this->modelManager->findBy($this->class);