Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Commit

Permalink
[DC-825] fix generation of model classes with column aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Enrico Stahn authored and Enrico Stahn committed Aug 13, 2010
1 parent 05bb41d commit f4a18e6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/Doctrine/Record/Generator.php
Expand Up @@ -431,7 +431,17 @@ public function generateClassFromTable(Doctrine_Table $table)
$definition['columns'] = $table->getColumns();
$definition['tableName'] = $table->getTableName();
$definition['actAs'] = $table->getTemplates();


// FIX: DC-825 This is probably not the right place to fix the issue.
// Doctrine_Table::getColumns() should return the correct alias information.
foreach ($definition['columns'] as $column => $def) {
if ($column == $table->getFieldName($column)) {
continue;
}

$definition['columns'][$column]['name'] = $column . ' as ' . $table->getFieldName($column);
}

return $this->generateClass($definition);
}

Expand Down

0 comments on commit f4a18e6

Please sign in to comment.