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

Prefixing alias counter with _ to fix DDC-3042 and prevent collisions

This commit is contained in:
Marco Pivetta 2014-03-21 18:51:46 +01:00
parent 11b3065fd1
commit e6bf096583
2 changed files with 2 additions and 2 deletions

View File

@ -91,6 +91,6 @@ class AnsiQuoteStrategy implements QuoteStrategy
*/
public function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null)
{
return $platform->getSQLResultCasing($columnName . $counter);
return $platform->getSQLResultCasing($columnName . '_' . $counter);
}
}

View File

@ -131,7 +131,7 @@ class DefaultQuoteStrategy implements QuoteStrategy
// If the alias is to long, characters are cut off from the beginning.
// 3 ) Strip non alphanumeric characters
// 4 ) Prefix with "_" if the result its numeric
$columnName = $columnName . $counter;
$columnName = $columnName . '_' . $counter;
$columnName = substr($columnName, -$platform->getMaxIdentifierLength());
$columnName = preg_replace('/[^A-Za-z0-9_]/', '', $columnName);
$columnName = is_numeric($columnName) ? '_' . $columnName : $columnName;