I am trying to add pagination on demand using Doctrine and the Doctrine Paginator class:
$qb = $this->_em->createQueryBuilder();
$qb->select(array('a.id'))
->from('MyProjectBundle:Account', 'a')
->leftjoin('a.first', 'fd')
->leftjoin('a.second', 'fr')
->where('a != ?1')
->setParameters(array(1 => $account))
->setFirstResult(($page-1) * $per_page)
->setMaxResults($per_page);
And as in the documentation for Paginator, I do:
return new Paginator($qb);
I have this error:
{
"code": 500,
"message": "[Semantical Error] The annotation \"@Enum\" in property Doctrine\\ORM\\Mapping\\GeneratedValue::$strategy was never imported. Did you maybe forget to add a \"use\" statement for this annotation?"
}
I turn it on use Doctrine\ORM\Tools\Pagination\Paginator;and I don’t know why I have this error?
source
share