public function testSetCustomHydrator() { /** @var HydratorInterface $customHydrator */ $customHydrator = $this->getMockForAbstractClass('\\Dive\\Hydrator\\HydratorInterface'); $this->rm->setHydrator('custom', $customHydrator); $actualCustomHydrator = $this->rm->getHydrator('custom'); $this->assertEquals($customHydrator, $actualCustomHydrator); }
/** * Executes the query and returns hydrated result * * @param string $fetchMode * @return mixed */ public function execute($fetchMode = null) { if (null === $fetchMode) { $fetchMode = $this->getFetchMode(); } // parsed sql statement $sql = $this->getSql(); // build pdo statement $stmt = $this->getConnection()->getStatement($sql, $this->getParamsFlattened()); $hydrator = $this->rm->getHydrator($fetchMode); $hydrator->setStatement($stmt); return $hydrator->getResult($this->getRootTable()); }