From fb7adbbebb5c2e5248993a8de7d60c892453bbd6 Mon Sep 17 00:00:00 2001 From: jwage Date: Sun, 4 Oct 2009 00:06:22 +0000 Subject: [PATCH] [2.0] Added exception if query builder is missing from or select when trying to get dql string --- lib/Doctrine/ORM/QueryBuilder.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/QueryBuilder.php b/lib/Doctrine/ORM/QueryBuilder.php index b6c029864..5a2ffaf8b 100644 --- a/lib/Doctrine/ORM/QueryBuilder.php +++ b/lib/Doctrine/ORM/QueryBuilder.php @@ -21,7 +21,8 @@ namespace Doctrine\ORM; -use Doctrine\ORM\Query\Expr; +use Doctrine\ORM\Query\Expr, + Doctrine\Common\DoctrineException; /** * This class is responsible for building DQL query strings via an object oriented @@ -191,6 +192,10 @@ class QueryBuilder return $this->_dql; } + if ( ! $this->_dqlParts['select'] || ! $this->_dqlParts['from']) { + throw DoctrineException::incompleteQueryBuilder(); + } + $dql = ''; switch ($this->_type) {