My TYPO3 6.2 (Upgraded from TYPO3 4.5) fluid paginate displays all the items instead of 5 items.
My Repository Method :
public function getRandomLocation($iLimit)
{
$query = $this->createQuery();
$result = $query->statement("Select * FROM tx_sfel_domain_model_ttblocationsproduktegruppen WHERE hidden = 0 AND deleted = 0 AND logo != '' ORDER BY uid LIMIT 0, ".$iLimit." ");
return $result->execute();
}
My controller code :
$aSResultsLocations = $this->tTBLocationsProdukteGruppenRepository->getRandomLocation($iLimit);
$this->view->assign('aSResultsLocations', $aSResultsLocations);
My template :
<f:widget.paginate objects="{aSResultsLocations}" as="aSResultsLocationss" configuration="{itemsPerPage: 5, insertAbove: 1 insertBelow: 1}">
<f:for each="{aSResultsLocationss}" as="aSResultsLocation">
.................
//Getting all the items instead of 5 items.
</f:for>
</f:widget.paginate>
In TYPO3\CMS\Fluid\ViewHelpers\Widget\Controller\PaginateController.php indexaction()
I'm getting following results.
Code :
$itemsPerPage = (int)$this->configuration['itemsPerPage'];
$query = $this->objects->getQuery();
$query->setLimit($itemsPerPage);
if ($this->currentPage > 1) {
$query->setOffset((int)($itemsPerPage * ($this->currentPage - 1)));
}
$modifiedObjects = $query->execute();
Values I got from here are :
$itemsPerPage : 5
$query : Select * FROM tx_sfel_domain_model_ttblocationsproduktegruppen WHERE hidden = 0 AND deleted = 0 AND (jahr = '13' OR jahr = '14' OR jahr = '15') AND logo != '' ORDER BY uid LIMIT 0, 26
$modifiedObjects count = 26
But I need '$modifiedObjects count' as 5.
I think Following are not working for my query object,
$query->setLimit($itemsPerPage);
$query->setOffset((int)($itemsPerPage * ($this->currentPage - 1)));
I think this issue is something related to my query object using in the paginate. How to create query object for TYPO3 6.2 fluid paginate??
Please help me.