Cupara
Well-known member
I'm using the finder to grab entries from the database. Problem is that no matter which table I'm grabbing, it only grabs 23 entries even though in one table there are 956 entries, in another table, there are over 200,000 entries. Is there anything I should check? Here is the code from one page for the index.
PHP:
public function actionIndex()
{
$finder = \XF::finder('BetClever\Tipsters:Leagues');
$page = $this->filterPage();
$perPage = 10;
$finder->limitByPage($page, $perPage);
$filter = $this->filter('_xfFilter', [
'text' => 'str',
'prefix' => 'bool'
]);
if (strlen($filter['text']))
{
$finder->whereOr([
['league_name', 'LIKE', $finder->escapeLike($filter['text'], $filter['prefix'] ? '?%' : '%?%')],
['Sports.name', 'LIKE', $finder->escapeLike($filter['text'], $filter['prefix'] ? '?%' : '%?%')],
['Countries.name', 'LIKE', $finder->escapeLike($filter['text'], $filter['prefix'] ? '?%' : '%?%')]
]);
}
$total = $finder->total();
$leagues = $finder->with('Sports', 'Countries')->order('id', 'ASC')->fetch();
$viewParams = [
'leagues' => $leagues,
'total' => $total,
'page' => $page,
'perPage' => $perPage,
'filter' => $filter['text']
];
return $this->view('BetClever\Tipsters:Leagues\Listing', 'bc_admin_leagues_list', $viewParams);
}