소스 검색

Merge pull request #44 from EmmanuelVella/patch-3

Add exception if sonata_type_admin has no association admin
Thomas 13 년 전
부모
커밋
55839fcc2c
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') {