$query = $this->createQueryBuilder('p');
$query
->select('s', 'p')
->innerJoin(
'test\Entity\ProductQuantity',
's',
\Doctrine\ORM\Query\Expr\Join::WITH,
'p.sku = s.sku'
)
->orderBy('p.productId', 'DESC');
return $query->getQuery()->getResult();
这个查询必须返回2个表的结果,但我得到的是:
result = array(
[0] => 'table1',
[1]=> 'table2',
[2] => 'table1',
[3]=> 'table2',
)
为什么我在两个数组中得到了2个表格?这是联接查询,必须在一个数组中,如何将联接查询结果合并到一个数组中并获得以下结果:
result = array(
[0] => 'table1table2',
[1] => 'table1table2',
)