Move identifier types extraction to a method
This commit is contained in:
parent
60a2628f9d
commit
eba8fec1fb
@ -344,16 +344,28 @@ class BasicEntityPersister implements EntityPersister
|
|||||||
. ' FROM ' . $tableName
|
. ' FROM ' . $tableName
|
||||||
. ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?';
|
. ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?';
|
||||||
|
|
||||||
|
|
||||||
|
$flatId = $this->identifierFlattener->flattenIdentifier($versionedClass, $id);
|
||||||
|
|
||||||
|
$value = $this->conn->fetchColumn(
|
||||||
|
$sql,
|
||||||
|
array_values($flatId),
|
||||||
|
0,
|
||||||
|
$this->extractIdentifierTypes($id, $versionedClass)
|
||||||
|
);
|
||||||
|
|
||||||
|
return Type::getType($fieldMapping['type'])->convertToPHPValue($value, $this->platform);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function extractIdentifierTypes(array $id, ClassMetadata $versionedClass) : array
|
||||||
|
{
|
||||||
$types = [];
|
$types = [];
|
||||||
|
|
||||||
foreach ($id as $field => $value) {
|
foreach ($id as $field => $value) {
|
||||||
$types = array_merge($types, $this->getTypes($field, $value, $versionedClass));
|
$types = array_merge($types, $this->getTypes($field, $value, $versionedClass));
|
||||||
}
|
}
|
||||||
|
|
||||||
$flatId = $this->identifierFlattener->flattenIdentifier($versionedClass, $id);
|
return $types;
|
||||||
|
|
||||||
$value = $this->conn->fetchColumn($sql, array_values($flatId), 0, $types);
|
|
||||||
|
|
||||||
return Type::getType($fieldMapping['type'])->convertToPHPValue($value, $this->platform);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user