/** * @return array */ protected function run() { if (!$this->result || $this->queryBuilder->getState() === QueryBuilder::STATE_DIRTY) { $statement = $this->queryBuilder->execute(); $statement->setFetchMode(\PDO::FETCH_ASSOC); $rows = $statement->fetchAll(); $statement->closeCursor(); $this->result = $this->mapper ? $this->mapper->collection($rows) : $rows; } return $this->result; }
/** * @test */ public function getStateDelegatesToConcreteQueryBuilder() { $this->concreteQueryBuilder->getState()->shouldBeCalled()->willReturn(\Doctrine\DBAL\Query\QueryBuilder::STATE_CLEAN); $this->subject->getState(); }
public function testSetFirstResult() { $qb = new QueryBuilder($this->conn); $qb->setFirstResult(10); $this->assertEquals(QueryBuilder::STATE_DIRTY, $qb->getState()); $this->assertEQuals(10, $qb->getFirstResult()); }
/** * Gets the state of this query builder instance. * * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN. */ public function getState() { return $this->queryBuilder->getState(); }
/** * Gets the state of this query builder instance. * * @return int Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN. * @internal */ public function getState() : int { return $this->concreteQueryBuilder->getState(); }
/** * Gets the state of this query builder instance. * * @return integer Either Doctrine\DBAL\Query\QueryBuilder::STATE_DIRTY * or Doctrine\DBAL\Query\QueryBuilder::STATE_CLEAN. */ public function getState() { return $this->qb->getState(); }