瀏覽代碼

Add exception if sonata_type_admin has not association admin

Emmanuel Vella 13 年之前
父節點
當前提交
f0eb751f9e
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      Builder/FormContractor.php

+ 3 - 1
Builder/FormContractor.php

@@ -122,7 +122,9 @@ class FormContractor implements FormContractorInterface
 
         } else if ($type == 'sonata_type_admin') {
 
-            // nothing here ...
+            if (!$fieldDescription->getAssociationAdmin()) {
+                throw new \RuntimeException(sprintf('The current field `%s` is not linked to an admin. Please create one for the target entity : `%s`', $fieldDescription->getName(), $fieldDescription->getTargetEntity()));
+            }
 
         } else if ($type == 'sonata_type_collection') {