Right owning side column selection
This commit is contained in:
parent
2eb428df79
commit
1d40c85c3c
1 changed files with 5 additions and 5 deletions
|
@ -349,9 +349,11 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||||
$associationSourceClass = $this->em->getClassMetadata($mapping['targetEntity']);
|
$associationSourceClass = $this->em->getClassMetadata($mapping['targetEntity']);
|
||||||
$mapping = $associationSourceClass->associationMappings[$mapping['mappedBy']];
|
$mapping = $associationSourceClass->associationMappings[$mapping['mappedBy']];
|
||||||
$joinColumns = $mapping['joinTable']['joinColumns'];
|
$joinColumns = $mapping['joinTable']['joinColumns'];
|
||||||
|
$relationMode = 'relationToTargetKeyColumns';
|
||||||
} else {
|
} else {
|
||||||
$joinColumns = $mapping['joinTable']['inverseJoinColumns'];
|
$joinColumns = $mapping['joinTable']['inverseJoinColumns'];
|
||||||
$associationSourceClass = $this->em->getClassMetadata($mapping['sourceEntity']);
|
$associationSourceClass = $this->em->getClassMetadata($mapping['sourceEntity']);
|
||||||
|
$relationMode = 'relationToSourceKeyColumns';
|
||||||
}
|
}
|
||||||
|
|
||||||
$quotedJoinTable = $this->quoteStrategy->getJoinTableName($mapping, $associationSourceClass, $this->platform). ' t';
|
$quotedJoinTable = $this->quoteStrategy->getJoinTableName($mapping, $associationSourceClass, $this->platform). ' t';
|
||||||
|
@ -375,13 +377,11 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($mapping['joinTableColumns'] as $joinTableColumn) {
|
foreach ($mapping['joinTableColumns'] as $joinTableColumn) {
|
||||||
|
if (isset($mapping[$relationMode][$joinTableColumn])) {
|
||||||
|
|
||||||
if (isset($mapping['relationToTargetKeyColumns'][$joinTableColumn])) {
|
|
||||||
$whereClauses[] = 't.' . $joinTableColumn . ' = ?';
|
$whereClauses[] = 't.' . $joinTableColumn . ' = ?';
|
||||||
$params[] = $targetEntity->containsForeignIdentifier
|
$params[] = $targetEntity->containsForeignIdentifier
|
||||||
? $id[$targetEntity->getFieldForColumn($mapping['relationToTargetKeyColumns'][$joinTableColumn])]
|
? $id[$targetEntity->getFieldForColumn($mapping[$relationMode][$joinTableColumn])]
|
||||||
: $id[$targetEntity->fieldNames[$mapping['relationToTargetKeyColumns'][$joinTableColumn]]];
|
: $id[$targetEntity->fieldNames[$mapping[$relationMode][$joinTableColumn]]];
|
||||||
} elseif (!$joinNeeded) {
|
} elseif (!$joinNeeded) {
|
||||||
$whereClauses[] = 't.' . $joinTableColumn . ' = ?';
|
$whereClauses[] = 't.' . $joinTableColumn . ' = ?';
|
||||||
$params[] = $key;
|
$params[] = $key;
|
||||||
|
|
Loading…
Add table
Reference in a new issue