diff --git a/lib/Doctrine/Query.php b/lib/Doctrine/Query.php index b6b1626d4..70d23238f 100644 --- a/lib/Doctrine/Query.php +++ b/lib/Doctrine/Query.php @@ -757,11 +757,11 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria . $this->_conn->quoteIdentifier($field); } else { // build sql expression + $field = $this->getRoot()->getColumnName($field); $term[0] = $this->_conn->quoteIdentifier($field); } } } else { - if ( ! empty($term[0]) && ! in_array(strtoupper($term[0]), self::$_keywords) && ! is_numeric($term[0])) { @@ -775,13 +775,12 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria $table = $this->_queryComponents[$componentAlias]['table']; // check column existence - if ($table->hasColumn($term[0])) { + if ($table->hasField($term[0])) { $found = true; - $def = $table->getDefinitionOf($term[0]); - // get the actual column name from alias + // get the actual column name from field name $term[0] = $table->getColumnName($term[0]); diff --git a/lib/Doctrine/Query/Where.php b/lib/Doctrine/Query/Where.php index be4128007..640b43f70 100644 --- a/lib/Doctrine/Query/Where.php +++ b/lib/Doctrine/Query/Where.php @@ -77,7 +77,7 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition } } $first = $this->query->parseClause($first); - + $sql = $first . ' ' . $operator . ' ' . $this->parseValue($value, $table, $field); return $sql;