コード例 #1
0
 /**
  * Create a new instance for the given hydration mode.
  *
  * @param  int $hydrationMode
  * @return Doctrine\ORM\Internal\Hydration\AbstractHydrator
  */
 public function newHydrator($hydrationMode)
 {
     switch ($hydrationMode) {
         case Query::HYDRATE_OBJECT:
             $hydrator = new Internal\Hydration\ObjectHydrator($this);
             break;
         case Query::HYDRATE_ARRAY:
             $hydrator = new Internal\Hydration\ArrayHydrator($this);
             break;
         case Query::HYDRATE_SCALAR:
             $hydrator = new Internal\Hydration\ScalarHydrator($this);
             break;
         case Query::HYDRATE_SINGLE_SCALAR:
             $hydrator = new Internal\Hydration\SingleScalarHydrator($this);
             break;
         case Query::HYDRATE_SIMPLEOBJECT:
             $hydrator = new Internal\Hydration\SimpleObjectHydrator($this);
             break;
         default:
             if ($class = $this->config->getCustomHydrationMode($hydrationMode)) {
                 $hydrator = new $class($this);
                 break;
             }
             throw ORMException::invalidHydrationMode($hydrationMode);
     }
     return $hydrator;
 }