/** * Next */ public function next() { $this->currentItem = $this->statement->fetch(); if (false !== $this->currentItem) { $this->currentKey++; } else { $this->batchPosition++; $this->queryBuilder->setFirstResult($this->batchSize * $this->batchPosition); $this->queryBuilder->setMaxResults($this->batchSize); /* @var $stmt \Doctrine\DBAL\Statement */ $this->statement = $this->queryBuilder->execute(); $this->statement->setFetchMode(\PDO::FETCH_ASSOC); $this->currentItem = $this->statement->fetch(); if (false === $this->currentItem) { $this->currentKey = -1; } } }
private function hydrateEvents(PDOStatement $stmt) { return array_map(function ($eventArray) { return $this->serializer->deserialize($eventArray['event'], $eventArray['event_class']); }, $stmt->fetchAll()); }