| @@ 31-50 (lines=20) @@ | ||
| 28 | $this->cursorBuilder = $cursorBuilder; |
|
| 29 | } |
|
| 30 | ||
| 31 | public function getResultForQuery(ConfiguredQuery $configuredQuery, Pager $pager): Result |
|
| 32 | { |
|
| 33 | $analysedQuery = $this->queryAnalyser->analyseQuery($configuredQuery, $pager); |
|
| 34 | ||
| 35 | $result = $this->buildResult($analysedQuery, $pager); |
|
| 36 | ||
| 37 | if ($configuredQuery->getItemTransformer() !== null) { |
|
| 38 | $this->transformResultItems($configuredQuery->getItemTransformer(), $result); |
|
| 39 | } |
|
| 40 | ||
| 41 | if ($configuredQuery->isTotalCountNeeded()) { |
|
| 42 | $totalCount = $this->calculateTotalCount($pager, count($result->getItems())); |
|
| 43 | if ($totalCount === null) { |
|
| 44 | $totalCount = $this->findCount($analysedQuery); |
|
| 45 | } |
|
| 46 | $result->setTotalCount($totalCount); |
|
| 47 | } |
|
| 48 | ||
| 49 | return $result; |
|
| 50 | } |
|
| 51 | ||
| 52 | public function getTotalCountForQuery(ConfiguredQuery $configuredQuery): int |
|
| 53 | { |
|
| @@ 25-44 (lines=20) @@ | ||
| 22 | $this->cursorBuilder = $cursorBuilder; |
|
| 23 | } |
|
| 24 | ||
| 25 | public function getResultForQuery(ConfiguredQuery $configuredQuery, Pager $pager): Result |
|
| 26 | { |
|
| 27 | $analysedQuery = $this->queryAnalyser->analyseQuery($configuredQuery, $pager); |
|
| 28 | ||
| 29 | $result = $this->buildResult($analysedQuery, $pager); |
|
| 30 | ||
| 31 | if ($configuredQuery->getItemTransformer() !== null) { |
|
| 32 | $this->transformResultItems($configuredQuery->getItemTransformer(), $result); |
|
| 33 | } |
|
| 34 | ||
| 35 | if ($configuredQuery->isTotalCountNeeded()) { |
|
| 36 | $totalCount = $this->calculateTotalCount($pager, count($result->getItems())); |
|
| 37 | if ($totalCount === null) { |
|
| 38 | $totalCount = $this->findCount($analysedQuery); |
|
| 39 | } |
|
| 40 | $result->setTotalCount($totalCount); |
|
| 41 | } |
|
| 42 | ||
| 43 | return $result; |
|
| 44 | } |
|
| 45 | ||
| 46 | // public function getTotalCountForQuery(ConfiguredQuery $configuredQuery): int |
|
| 47 | // { |
|