Skip to content

Commit

Permalink
Merge pull request #386 from SamsonIT/fix_fetch_relation_by_id_of_ass…
Browse files Browse the repository at this point in the history
…ociation_field

[DDC-1895] Fix fetch relation by id of association field
  • Loading branch information
guilhermeblanco committed Jul 3, 2012
2 parents 417b6b0 + 5dc999a commit ab851ab
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/Doctrine/ORM/Persisters/BasicEntityPersister.php
Expand Up @@ -349,7 +349,19 @@ protected final function _updateTable($entity, $quotedTableName, array $updateDa
$targetMapping = $this->_em->getClassMetadata($this->_class->associationMappings[$idField]['targetEntity']);
$where[] = $this->_class->associationMappings[$idField]['joinColumns'][0]['name'];
$params[] = $id[$idField];
$types[] = $targetMapping->fieldMappings[$targetMapping->identifier[0]]['type'];

switch (true) {
case (isset($targetMapping->fieldMappings[$targetMapping->identifier[0]])):
$types[] = $targetMapping->fieldMappings[$targetMapping->identifier[0]]['type'];
break;

case (isset($targetMapping->associationMappings[$targetMapping->identifier[0]])):
$types[] = $targetMapping->associationMappings[$targetMapping->identifier[0]]['type'];
break;

default:
throw ORMException::unrecognizedField($targetMapping->identifier[0]);
}
} else {
$where[] = $this->_class->getQuotedColumnName($idField, $this->_platform);
$params[] = $id[$idField];
Expand Down

0 comments on commit ab851ab

Please sign in to comment.