Reputation: 35
I'm trying to do the pagination, but there is an error:
$dql = "SELECT cast(ip as CHAR) as ip FROM histories";
$query = $em->createQuery($dql)->setFirstResult($offset)->setMaxResults($limit);
$paginator = new Paginator($query);
$maxpage = ceil($paginator->count() / $limit);
Error
[Syntax Error] line 0, col 7: Error: Expected IdentificationVariable | ScalarExpression | AggregateExpression | FunctionDeclaration | PartialObjectExpression | "(" Subselect ")" | CaseExpression, got '*'
$maxpage = ceil($paginator->count() / $limit); //error line
Upvotes: 1
Views: 1062
Reputation: 1389
Please try that :
$maxpage = ceil(count($paginator) / $limit);
Upvotes: 1