1
0
mirror of synced 2025-01-31 04:21:44 +03:00

Fix: handle invalid discriminator value

This commit is contained in:
Frank 2014-04-09 01:55:54 +02:00
parent f7b95c1aa5
commit d1c722c1d0

View File

@ -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]);
}