Created
September 12, 2016 22:27
-
-
Save ABM-Dan/a008ca494b8ce500e94f9c0e6881febf to your computer and use it in GitHub Desktop.
Holy hardcoded system, Batman!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* {@inheritDoc} | |
*/ | |
public function newHydrator($hydrationMode) | |
{ | |
switch ($hydrationMode) { | |
case Query::HYDRATE_OBJECT: | |
return new Internal\Hydration\ObjectHydrator($this); | |
case Query::HYDRATE_ARRAY: | |
return new Internal\Hydration\ArrayHydrator($this); | |
case Query::HYDRATE_SCALAR: | |
return new Internal\Hydration\ScalarHydrator($this); | |
case Query::HYDRATE_SINGLE_SCALAR: | |
return new Internal\Hydration\SingleScalarHydrator($this); | |
case Query::HYDRATE_SIMPLEOBJECT: | |
return new Internal\Hydration\SimpleObjectHydrator($this); | |
default: | |
if (($class = $this->config->getCustomHydrationMode($hydrationMode)) !== null) { | |
return new $class($this); | |
} | |
} | |
throw ORMException::invalidHydrationMode($hydrationMode); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment