3 namespace Doctrine\Tests\ORM\Hydration;
5 use PDO, Doctrine\ORM\Internal\Hydration\AbstractHydrator;
7 require_once __DIR__ . '/../../TestInit.php';
9 class CustomHydratorTest extends HydrationTestCase
11 public function testCustomHydrator()
13 $em = $this->_getTestEntityManager();
14 $config = $em->getConfiguration();
15 $config->addCustomHydrationMode('CustomHydrator', 'Doctrine\Tests\ORM\Hydration\CustomHydrator');
17 $hydrator = $em->newHydrator('CustomHydrator');
18 $this->assertInstanceOf('Doctrine\Tests\ORM\Hydration\CustomHydrator', $hydrator);
19 $this->assertNull($config->getCustomHydrationMode('does not exist'));
23 class CustomHydrator extends AbstractHydrator
25 protected function hydrateAllData()
27 return $this->_stmt->fetchAll(PDO::FETCH_ASSOC);