我正在尝试使用Doctrine和Doctrine类Paginator在查询中添加分页:
$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);
就像在Paginator的文档中一样,我这样做:
return new Paginator($qb);
我有这个错误:
{
"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?"
}
我包含use Doctrine\ORM\Tools\Pagination\Paginator;
,我不知道为什么会出现此错误?