我想用至少2个左连接对复杂请求进行分页,但是我使用(KnpPaginationBundle)的分页包不能告诉Doctrine如何计算结果(这是分页所需的)过程),并继续这个例外。 无法计数选择两个FROM组件的查询,无法区分 500内部服务器错误 - RuntimeException
$em = $this->getDoctrine()->getManager();
$user = $this->container->get('security.context')->getToken()->getUser();
$user->getId();
$dql = "SELECT o FROM DefaultBundle:Offer o ,DefaultBundle:FavoriteOffer fo WHERE fo.offerid=o.id and fo.userid =".$user->getId();
$query = $em->createQuery($dql);
$paginator = $this->get('knp_paginator');
$table = $paginator->paginate($query, $request->query->getInt('page', 1), 10);
关于如何对复杂请求进行分页的任何想法,谢谢。
最喜欢的优惠
class FavoriteOffer
{
/**
* @var \Offer
*
* @ORM\ManyToOne(targetEntity="Offer")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="Offerid", referencedColumnName="id")
* })
*/
private $offerid;
/**
* @var \User
*
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="Userid", referencedColumnName="id")
* })
*/
private $userid;