1
0
mirror of synced 2024-12-05 03:06:05 +03:00

Handling composite keys on non cache-able entities

This commit is contained in:
Asmir Mustafic 2015-02-20 10:00:36 +01:00
parent 24dd0c6a55
commit d72ad9cc50

View File

@ -92,7 +92,19 @@ class DefaultEntityHydrator implements EntityHydrator
unset($data[$name]);
foreach ($associationIds as $fieldName => $fieldValue) {
$data[$assoc['targetToSourceKeyColumns'][$targetClassMetadata->getColumnName($fieldName)]] = $fieldValue;
if (isset($targetClassMetadata->associationMappings[$fieldName])){
$targetAssoc = $targetClassMetadata->associationMappings[$fieldName];
foreach($assoc['targetToSourceKeyColumns'] as $referencedColumn => $localColumn) {
if (isset($targetAssoc['sourceToTargetKeyColumns'][$referencedColumn])) {
$data[$localColumn] = $fieldValue;
}
}
}else{
$data[$assoc['targetToSourceKeyColumns'][$targetClassMetadata->columnNames[$fieldName]]] = $fieldValue;
}
}
continue;