1
0
mirror of synced 2025-02-09 08:49:26 +03:00

Move identifier types extraction to a method

This commit is contained in:
Luís Cobucci 2017-07-22 22:39:47 +02:00
parent 60a2628f9d
commit eba8fec1fb
No known key found for this signature in database
GPG Key ID: EC61C5F01750ED3C

View File

@ -344,16 +344,28 @@ class BasicEntityPersister implements EntityPersister
. ' FROM ' . $tableName
. ' 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 = [];
foreach ($id as $field => $value) {
$types = array_merge($types, $this->getTypes($field, $value, $versionedClass));
}
$flatId = $this->identifierFlattener->flattenIdentifier($versionedClass, $id);
$value = $this->conn->fetchColumn($sql, array_values($flatId), 0, $types);
return Type::getType($fieldMapping['type'])->convertToPHPValue($value, $this->platform);
return $types;
}
/**