Skip to content

Commit fab4312

Browse files
committed
Merge pull request #284 from pierrerolland/fix-array-db-type
Issue #186 : allows "array" db type to be used with a collection form type
2 parents 3ce13c7 + 134f79a commit fab4312

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Guesser/DoctrineFieldGuesser.php

+10-6
Original file line numberDiff line numberDiff line change
@@ -286,17 +286,21 @@ protected function getOptions($type, $dbType, $model, $fieldPath, $filter = fals
286286
}
287287

288288
if (preg_match("/CollectionType$/i", $type)) {
289-
$mapping = $this->getMetadatas($class)->getAssociationMapping($columnName);
290-
291-
return array(
289+
$options = array(
292290
'allow_add' => true,
293291
'allow_delete' => true,
294292
'by_reference' => false,
295293
'entry_type' => $filter ? $this->filterTypes[$this->objectModel] : $this->formTypes[$this->objectModel],
296-
'entry_options' => array(
297-
'class' => $mapping['target'.ucfirst($this->objectModel)]
298-
)
299294
);
295+
296+
if ($this->getMetadatas($class)->hasAssociation($columnName)) {
297+
$mapping = $this->getMetadatas($class)->getAssociationMapping($columnName);
298+
$options['entry_options'] = array(
299+
'class' => $mapping['target'.ucfirst($this->objectModel)]
300+
);
301+
}
302+
303+
return $options;
300304
}
301305

302306
return array(

0 commit comments

Comments
 (0)