diff --git a/lib/Doctrine/Hook.php b/lib/Doctrine/Hook.php index ddfa50d65..c1dbf00c9 100644 --- a/lib/Doctrine/Hook.php +++ b/lib/Doctrine/Hook.php @@ -79,6 +79,8 @@ class Doctrine_Hook $this->query->parseQuery($query); } elseif ($query instanceof Doctrine_Query) { $this->query = $query; + } else { + throw new Doctrine_Exception('Constructor argument should be either Doctrine_Query object or valid DQL query'); } } /** @@ -132,6 +134,10 @@ class Doctrine_Hook $tableAlias = $this->query->getTableAlias($alias); $table = $this->query->getTable($tableAlias); + if ( ! $table) { + throw new Doctrine_Exception('Unknown table alias ' . $tableAlias); + } + if ($def = $table->getDefinitionOf($column)) { if (isset($this->typeParsers[$def[0]])) { $name = $this->typeParsers[$def[0]];