在规则2中,如何将子查询结果添加到主查询结果的末尾?
$QB-主查询
$sub子查询
public function findPosts(): array
{
$ids = '777, 775, 767, 756, 752, 751, 732, 727, 725, 721, 717, 710, 702, 693, 678, 671, 662, 658, 639, 638, 617, 598, 579';
$qb = $this->createQueryBuilder('article');
$qb->where('article.visible = 1')
->andWhere('article.published_at <= :present_date')
->setParameter('present_date', date('Y-m-d H:i:s'))
->orderBy('article.id', 'DESC')
->select('article.id', 'article.title', 'article.slug', 'article.slots_type', 'article.skill', 'article.type', 'article.views', 'article.vk_shares', 'article.fb_shares')
->leftJoin('article.img', 'image')
->addSelect('image.filename AS img')
->setMaxResults(30);
$sub = $this->createQueryBuilder('article');
$sub->where('article.id IN ('.$ids.')')
->andWhere('article.visible = 1')
->orderBy('article.id', 'DESC')
->select('article.id', 'article.title', 'article.slug', 'article.slots_type', 'article.skill', 'article.type', 'article.views', 'article.vk_shares', 'article.fb_shares');
return $qb->getQuery()->execute();
}
我try 使用field函数,但没有得到预期的结果