瀏覽代碼

Add count check to sonata_type_model

Quentin Somazzi 9 年之前
父節點
當前提交
4fa888d039
共有 1 個文件被更改,包括 1 次插入1 次删除
  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->query) {
                 $entities = $this->modelManager->executeQuery($this->query);
-            } elseif (is_array($this->choices)) {
+            } elseif (is_array($this->choices) && count($this->choices) > 0) {
                 $entities = $this->choices;
             } else {
                 $entities = $this->modelManager->findBy($this->class);