Explorar o código

Improve error message

Thomas Rabaix %!s(int64=13) %!d(string=hai) anos
pai
achega
70719e7f64
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      Builder/FormContractor.php

+ 4 - 0
Builder/FormContractor.php

@@ -126,6 +126,10 @@ class FormContractor implements FormContractorInterface
 
         } else if ($type == 'sonata_type_collection') {
 
+            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()));
+            }
+
             $options['type']         = 'sonata_type_admin';
             $options['modifiable']   = true;
             $options['type_options'] = array(