来自MyEntityRepository
$qb = $this->createQueryBuilder('e')
->select('partial e.{id, field0}')
;
echo $qb->getQuery()->getSQL();
给我
SELECT
e0_.id AS id_0
, e0_.field0_0 AS field0_0
, e0_.field1_1 AS field1_1
, e0_.field2_2 AS field2_2
, -- ...
FROM my_entity e0_
为什么选择我的所有字段?
与Doctrine partial queries return the complete object相同,不同之处在于我输入了错误的初始SQL。