fixed CTI column referencing within DQL
This commit is contained in:
parent
0cda367802
commit
4570b90079
@ -489,6 +489,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria
|
|||||||
|
|
||||||
$fields = $this->_pendingFields[$componentAlias];
|
$fields = $this->_pendingFields[$componentAlias];
|
||||||
|
|
||||||
|
|
||||||
// check for wildcards
|
// check for wildcards
|
||||||
if (in_array('*', $fields)) {
|
if (in_array('*', $fields)) {
|
||||||
//echo "<br />";Doctrine::dump($table->getColumnNames()); echo "<br />";
|
//echo "<br />";Doctrine::dump($table->getColumnNames()); echo "<br />";
|
||||||
@ -563,9 +564,6 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria
|
|||||||
|
|
||||||
return implode(', ', $sql);
|
return implode(', ', $sql);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$name = $table->getColumnName($field);
|
$name = $table->getColumnName($field);
|
||||||
|
|
||||||
$this->_neededTables[] = $tableAlias;
|
$this->_neededTables[] = $tableAlias;
|
||||||
@ -574,6 +572,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria
|
|||||||
. ' AS '
|
. ' AS '
|
||||||
. $this->_conn->quoteIdentifier($tableAlias . '__' . $name);
|
. $this->_conn->quoteIdentifier($tableAlias . '__' . $name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getExpressionOwner
|
* getExpressionOwner
|
||||||
@ -766,14 +765,20 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria
|
|||||||
|
|
||||||
$table = $this->_queryComponents[$componentAlias]['table'];
|
$table = $this->_queryComponents[$componentAlias]['table'];
|
||||||
|
|
||||||
|
$def = $table->getDefinitionOf($field);
|
||||||
|
|
||||||
// get the actual field name from alias
|
// get the actual field name from alias
|
||||||
$field = $table->getColumnName($field);
|
$field = $table->getColumnName($field);
|
||||||
|
|
||||||
// check column existence
|
// check column existence
|
||||||
if ( ! $table->hasColumn($field)) {
|
if ( ! $def) {
|
||||||
throw new Doctrine_Query_Exception('Unknown column ' . $field);
|
throw new Doctrine_Query_Exception('Unknown column ' . $field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($def['owner'])) {
|
||||||
|
$componentAlias = $componentAlias . '.' . $def['owner'];
|
||||||
|
}
|
||||||
|
|
||||||
$tableAlias = $this->getTableAlias($componentAlias);
|
$tableAlias = $this->getTableAlias($componentAlias);
|
||||||
|
|
||||||
// build sql expression
|
// build sql expression
|
||||||
@ -803,9 +808,19 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria
|
|||||||
if ($table->hasColumn($term[0])) {
|
if ($table->hasColumn($term[0])) {
|
||||||
$found = true;
|
$found = true;
|
||||||
|
|
||||||
// get the actual field name from alias
|
|
||||||
|
$def = $table->getDefinitionOf($term[0]);
|
||||||
|
|
||||||
|
// get the actual column name from alias
|
||||||
$term[0] = $table->getColumnName($term[0]);
|
$term[0] = $table->getColumnName($term[0]);
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($def['owner'])) {
|
||||||
|
$componentAlias = $componentAlias . '.' . $def['owner'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$tableAlias = $this->getTableAlias($componentAlias);
|
||||||
|
|
||||||
$tableAlias = $this->getTableAlias($componentAlias);
|
$tableAlias = $this->getTableAlias($componentAlias);
|
||||||
|
|
||||||
if ($this->getType() === Doctrine_Query::SELECT) {
|
if ($this->getType() === Doctrine_Query::SELECT) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user