本文整理匯總了PHP中Doctrine\ORM\Configuration::getCustomHydrationMode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Configuration::getCustomHydrationMode方法的具體用法?PHP Configuration::getCustomHydrationMode怎麽用?PHP Configuration::getCustomHydrationMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\ORM\Configuration
的用法示例。
在下文中一共展示了Configuration::getCustomHydrationMode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: newHydrator
/**
* 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;
}
示例2: testSetCustomHydrationModes
public function testSetCustomHydrationModes()
{
$this->configuration->addCustomHydrationMode('HydrationModeName', __CLASS__);
$this->assertSame(__CLASS__, $this->configuration->getCustomHydrationMode('HydrationModeName'));
$this->configuration->setCustomHydrationModes(array('AnotherHydrationModeName' => __CLASS__));
$this->assertNull($this->configuration->getCustomHydrationMode('HydrationModeName'));
$this->assertSame(__CLASS__, $this->configuration->getCustomHydrationMode('AnotherHydrationModeName'));
}