给定以下 DQL 查询:
SELECT
p,
(p.views * 0.1) + (p.likes * 0.9) as ratingPhoto
FROM
AppBundle:Photo p
ORDER BY
ratingPhoto DESC
我的结果集如下所示:
array (size=14)
0 =>
array (size=2)
0 => object(Photo)
'ratingPhoto' => string '1.42' (length=4)
1 =>
array (size=2)
0 => object(Photo)
'ratingPhoto' => string '1.31' (length=4)
...
是否有任何 DQL 功能,以便我只检索Photo
对象并从结果集中排除其他选定的字段?这是我期望的结果:
array (size=14)
0 => object(Photo)
1 => object(Photo)
...