protected function fetchObjectFromPersistence($identity, $targetType)
{
if (is_string($identity)) {
$object = $this->persistenceManager->getObjectByIdentifier($identity, $targetType);
} elseif (is_array($identity)) {
$object = $this->findObjectByIdentityProperties($identity, $targetType);
} else {
throw new InvalidSourceException(sprintf('The identity property is neither a string nor an array but of type "%s".', gettype($identity)), 1297931020);
}
return $object;
}