From ce8fa912047e1ee1d3ef700cc3b0414cb8dc3a21 Mon Sep 17 00:00:00 2001 From: zYne Date: Mon, 13 Aug 2007 21:14:53 +0000 Subject: [PATCH] --- lib/Doctrine/Query/Where.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/Doctrine/Query/Where.php b/lib/Doctrine/Query/Where.php index 586ac90ff..9bf9bb6c5 100644 --- a/lib/Doctrine/Query/Where.php +++ b/lib/Doctrine/Query/Where.php @@ -68,9 +68,13 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition $alias = $this->query->getTableAlias($reference); $table = $map['table']; - $first = $conn->quoteIdentifier($alias) - . '.' - . $conn->quoteIdentifier($table->getColumnName($field)); + if ($this->query->getType() === Doctrine_Query::SELECT) { + $first = $conn->quoteIdentifier($alias) + . '.' + . $conn->quoteIdentifier($table->getColumnName($field)); + } else { + $first = $conn->quoteIdentifier($table->getColumnName($field)); + } } else { $first = $this->query->parseClause($first); } @@ -126,8 +130,11 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition $this->query->addEnumParam($value, null, null); } } else { - // check if value is enumerated value - $enumIndex = $table->enumIndex($field, trim($value, "'")); + $enumIndex = false; + if (isset($table) && isset($field)) { + // check if value is enumerated value + $enumIndex = $table->enumIndex($field, trim($value, "'")); + } if ($enumIndex !== false) { $value = $enumIndex;