当我运行foreach然后在第一次迭代中我得到表r行对象并且在下一次迭代中我得到表ke行的对象。一旦表ke行迭代完成,然后在下一次迭代中我得到表r下一行对象然后我得到表ke行对象。 这是我的回购。
public function getPagedSelfReview(array $criteria)
{
$query = $this->createQueryBuilder('r');
$query ->select('r','ke')
->leftJoin(
'User\Entity\KraEvaluation', 'ke', \Doctrine\ORM\Query\Expr\Join::WITH, 'r.id = ke.kraReview and ke.evaluatedBy = :userId'
)
->andWhere('r.user = :userId')
->setMaxResults($criteria['limit'])
->setFirstResult($criteria['offset'])
->setParameter('userId', $criteria['userId'])
;
$paginator = new Paginator( $query );
return $paginator;
}
示例:
0 - table r first row
1 - table ke first row (based on join match with r first row's column)
2 - table ke Second row (based on join match with r first row's column)
3 - table r Second row
4 - table ke first row (based on join match with r second row's column)
5 - table ke Second row (based on join match with r second row's column)
等
需要输入
0 - array(
0=>table r first row,
1=> array(
0=>table ke first row (based on join match with r first row's column),
1=>table ke second row (based on join match with r first row's column)
)
)
1- array(
0=>table r Second row,
1=>array(
0=>table ke first row (based on join match with r Second row's column),
1=>table ke second row (based on join match with r Second row's column)
)
)