Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug #2113 #10480

Merged
merged 1 commit into from
Jun 8, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions phalcon/mvc/model/query.zep
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,8 @@ class Query implements QueryInterface, InjectionAwareInterface
protected final function _getSelectColumn(array! column)
{
var sqlColumns, columnType, sqlAliases, modelName, source,
columnDomain, sqlColumnAlias, bestAlias, preparedAlias, sqlExprColumn,
sqlAliasesModels, sqlModelsAliases, sqlColumn, columnData, balias;
columnDomain, sqlColumnAlias, preparedAlias, sqlExprColumn,
sqlAliasesModels, sqlColumn, columnData, balias;

if !fetch columnType, column["type"] {
throw new Exception("Corrupted SELECT AST");
Expand Down Expand Up @@ -743,19 +743,13 @@ class Query implements QueryInterface, InjectionAwareInterface
let sqlAliasesModels = this->_sqlAliasesModels,
modelName = sqlAliasesModels[columnDomain];

/**
* Get the best alias for the column
*/
let sqlModelsAliases = this->_sqlModelsAliases,
bestAlias = sqlModelsAliases[modelName];

/**
* If the best alias is the model name we lowercase the first letter
*/
if bestAlias == modelName {
if columnDomain == modelName {
let preparedAlias = lcfirst(modelName);
} else {
let preparedAlias = bestAlias;
let preparedAlias = columnDomain;
}

/**
Expand Down