diff --git a/lib/Doctrine/ORM/Query/Parser.php b/lib/Doctrine/ORM/Query/Parser.php index 7619359ce..6f8eda514 100644 --- a/lib/Doctrine/ORM/Query/Parser.php +++ b/lib/Doctrine/ORM/Query/Parser.php @@ -827,17 +827,13 @@ class Parser return; } - $foundRootEntity = false; - foreach ($this->identVariableExpressions as $dqlAlias => $expr) { if (isset($this->queryComponents[$dqlAlias]) && $this->queryComponents[$dqlAlias]['parent'] === null) { - $foundRootEntity = true; + return; } } - if ( ! $foundRootEntity) { - $this->semanticalError('Cannot select entity through identification variables without choosing at least one root entity alias.'); - } + $this->semanticalError('Cannot select entity through identification variables without choosing at least one root entity alias.'); } /**