protected function getQuery(Queryable $repository)
{
$query = $this->toQuery($this->doCreateQuery($repository));
if ($this->lastQuery && $this->lastQuery->getDQL() === $query->getDQL()) {
$query = $this->lastQuery;
}
if ($this->lastQuery !== $query) {
$this->lastResult = new ResultSet($query, $this, $repository);
}
return $this->lastQuery = $query;
}