/** * @param int|null * @return \ArrayIterator */ public function getIterator($hydrationMode = NULL) { if ($this->iterator !== NULL) { return $this->iterator; } if ($hydrationMode !== NULL) { $this->query->setHydrationMode($hydrationMode); } $this->frozen = TRUE; if ($this->fetchJoinCollection && ($this->query->getMaxResults() > 0 || $this->query->getFirstResult() > 0)) { $this->iterator = $this->createPaginatedQuery($this->query)->getIterator(); } else { $this->iterator = new \ArrayIterator($this->query->getResult(NULL)); } if ($this->repository && $this->queryObject) { $this->queryObject->queryFetched($this->repository, $this->iterator); } return $this->iterator; }