Skip to content

Commit

Permalink
Merge pull request #284 from pierrerolland/fix-array-db-type
Browse files Browse the repository at this point in the history
Issue #186 : allows "array" db type to be used with a collection form type
  • Loading branch information
sescandell committed May 23, 2016
2 parents 3ce13c7 + 134f79a commit fab4312
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Guesser/DoctrineFieldGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit fab4312

Please sign in to comment.