예제 #1
0
 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);
 }
예제 #2
0
파일: Query.php 프로젝트: sigma-z/dive
 /**
  * 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());
 }