From d1c722c1d0f537aa832ba21637e8a7494a1aa491 Mon Sep 17 00:00:00 2001 From: Frank <trainmaster@gmx.net> Date: Wed, 9 Apr 2014 01:55:54 +0200 Subject: [PATCH] Fix: handle invalid discriminator value --- .../ORM/Internal/Hydration/SimpleObjectHydrator.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php index eb0982c7d..504d82c51 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php @@ -98,7 +98,13 @@ class SimpleObjectHydrator extends AbstractHydrator throw HydrationException::emptyDiscriminatorValue(key($this->_rsm->aliasMap)); } - $entityName = $this->class->discriminatorMap[$sqlResult[$discrColumnName]]; + $discrMap = $this->class->discriminatorMap; + + if ( ! isset($discrMap[$sqlResult[$discrColumnName]])) { + throw HydrationException::invalidDiscriminatorValue($sqlResult[$discrColumnName], array_keys($discrMap)); + } + + $entityName = $discrMap[$sqlResult[$discrColumnName]]; unset($sqlResult[$discrColumnName]); }