diff --git a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php index 8e45117ab..70d47655d 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php @@ -583,10 +583,7 @@ class ObjectHydrator extends AbstractHydrator parent::onClear($eventArgs); $aliases = array_keys($this->identifierMap); - $this->identifierMap = array(); - foreach ($aliases as $alias) { - $this->identifierMap[$alias] = array(); - } + $this->identifierMap = array_fill_keys($aliases, []); } } 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.'); } /**