1
0
mirror of synced 2025-01-31 04:21:44 +03:00

Update SqlWalker.php

Always be sure that only a-z characters are used for table alias, otherwise use generic "t" for "table"
This commit is contained in:
Mike Meier 2013-03-15 13:53:22 +01:00 committed by Marco Pivetta
parent 06b5c84728
commit ebc996c820

View File

@ -291,7 +291,11 @@ class SqlWalker implements TreeWalker
$tableName .= ($dqlAlias) ? '@[' . $dqlAlias . ']' : '';
if ( ! isset($this->tableAliasMap[$tableName])) {
$this->tableAliasMap[$tableName] = strtolower(substr($tableName, 0, 1)) . $this->tableAliasCounter++ . '_';
$tablePrefixAlias = strtolower(substr($tableName, 0, 1));
if( ! preg_match("/[a-z]/", $tablePrefixAlias)) {
$tablePrefixAlias = 't';
}
$this->tableAliasMap[$tableName] = $tablePrefixAlias . $this->tableAliasCounter++ . '_';
}
return $this->tableAliasMap[$tableName];