Optimized column to field resolutions.
This commit is contained in:
parent
96955d6e79
commit
965cdbdbbb
@ -670,19 +670,9 @@ class BasicEntityPersister implements EntityPersister
|
||||
$this->quotedColumns[$sourceColumn] = $quotedColumn;
|
||||
$this->columnTypes[$sourceColumn] = $targetClass->getTypeOfColumn($targetColumn);
|
||||
|
||||
switch (true) {
|
||||
case $newVal === null:
|
||||
$value = null;
|
||||
break;
|
||||
|
||||
case $targetClass->containsForeignIdentifier:
|
||||
$value = $newValId[$targetClass->getFieldForColumn($targetColumn)];
|
||||
break;
|
||||
|
||||
default:
|
||||
$value = $newValId[$targetClass->fieldNames[$targetColumn]];
|
||||
break;
|
||||
}
|
||||
$value = ($newVal !== null)
|
||||
? $newValId[$targetClass->getFieldForColumn($targetColumn)]
|
||||
: null;
|
||||
|
||||
$result[$owningTable][$sourceColumn] = $value;
|
||||
}
|
||||
|
@ -105,9 +105,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
$columnName = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform);
|
||||
$referencedName = $joinColumn['referencedColumnName'];
|
||||
$conditions[] = 't.' . $columnName . ' = ?';
|
||||
$params[] = ($class->containsForeignIdentifier)
|
||||
? $id[$class->getFieldForColumn($referencedName)]
|
||||
: $id[$class->fieldNames[$referencedName]];
|
||||
$params[] = $id[$class->getFieldForColumn($referencedName)];
|
||||
}
|
||||
|
||||
$joinTableName = $this->quoteStrategy->getJoinTableName($association, $class, $this->platform);
|
||||
@ -554,9 +552,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
foreach ($mapping['joinTableColumns'] as $joinTableColumn) {
|
||||
if (isset($mapping[$relationMode][$joinTableColumn])) {
|
||||
$whereClauses[] = 't.' . $joinTableColumn . ' = ?';
|
||||
$params[] = $targetEntity->containsForeignIdentifier
|
||||
? $id[$targetEntity->getFieldForColumn($mapping[$relationMode][$joinTableColumn])]
|
||||
: $id[$targetEntity->fieldNames[$mapping[$relationMode][$joinTableColumn]]];
|
||||
$params[] = $id[$targetEntity->getFieldForColumn($mapping[$relationMode][$joinTableColumn])];
|
||||
} elseif (!$joinNeeded) {
|
||||
$whereClauses[] = 't.' . $joinTableColumn . ' = ?';
|
||||
$params[] = $key;
|
||||
@ -609,17 +605,13 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
$whereClauses[] = ($addFilters ? 't.' : '') . $joinTableColumn . ' = ?';
|
||||
|
||||
if (isset($mapping['relationToTargetKeyColumns'][$joinTableColumn])) {
|
||||
$params[] = ($targetClass->containsForeignIdentifier)
|
||||
? $targetId[$targetClass->getFieldForColumn($mapping['relationToTargetKeyColumns'][$joinTableColumn])]
|
||||
: $targetId[$targetClass->fieldNames[$mapping['relationToTargetKeyColumns'][$joinTableColumn]]];
|
||||
$params[] = $targetId[$targetClass->getFieldForColumn($mapping['relationToTargetKeyColumns'][$joinTableColumn])];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// relationToSourceKeyColumns
|
||||
$params[] = ($sourceClass->containsForeignIdentifier)
|
||||
? $sourceId[$sourceClass->getFieldForColumn($mapping['relationToSourceKeyColumns'][$joinTableColumn])]
|
||||
: $sourceId[$sourceClass->fieldNames[$mapping['relationToSourceKeyColumns'][$joinTableColumn]]];
|
||||
$params[] = $sourceId[$sourceClass->getFieldForColumn($mapping['relationToSourceKeyColumns'][$joinTableColumn])];
|
||||
}
|
||||
|
||||
if ($addFilters) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user