diff --git a/Guesser/DoctrineFieldGuesser.php b/Guesser/DoctrineFieldGuesser.php index ede483d8..65c186d5 100644 --- a/Guesser/DoctrineFieldGuesser.php +++ b/Guesser/DoctrineFieldGuesser.php @@ -286,17 +286,21 @@ protected function getOptions($type, $dbType, $model, $fieldPath, $filter = fals } if (preg_match("/CollectionType$/i", $type)) { - $mapping = $this->getMetadatas($class)->getAssociationMapping($columnName); - - return array( + $options = array( 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'entry_type' => $filter ? $this->filterTypes[$this->objectModel] : $this->formTypes[$this->objectModel], - 'entry_options' => array( - 'class' => $mapping['target'.ucfirst($this->objectModel)] - ) ); + + if ($this->getMetadatas($class)->hasAssociation($columnName)) { + $mapping = $this->getMetadatas($class)->getAssociationMapping($columnName); + $options['entry_options'] = array( + 'class' => $mapping['target'.ucfirst($this->objectModel)] + ); + } + + return $options; } return array(