/** * @param QueryInterface $query * @return array */ public function fetch(QueryInterface $query) { $query->checkReplacements(); $plainQuery = $query->getPlainQuery(); list($parameters, $plainQuery) = $this->modifyParametersFromArrayToScalar($query->getParameters(), $plainQuery); return $this->connection->fetchAll($plainQuery, $parameters); }
public function testExecuteCache() { $em = new EntityManager(); $connection = $em->getConnection(); $executor = new DbCacheableExecutor($em, new Cache(), new CacheHitsContainer()); $executor->execute($this->query); $executed = $connection->getLastExecuted(); $this->assertEquals(self::QUERY_PARSED, $executed['query']); $this->assertEquals($this->query->getParameters(), $executed['params']); $fetched = $executor->fetch($this->query); $this->assertEquals(self::QUERY_PARSED, $fetched['query']); $this->assertEquals($this->query->getParameters(), $fetched['params']); }
/** * @param QueryInterface $query * @return int */ public function execute(QueryInterface $query) { $query->checkReplacements(); list($parameters, $plainQuery) = $this->modifyParametersFromArrayToScalar($query->getParameters(), $query->getPlainQuery()); return $this->connection->executeQuery($plainQuery, $parameters, array(), $this->buildCache($query)); }