I would like to group my query with Doctrine in Symfony3 in one of my repository but will not return any result. Mainly I think because of the attached relations to the entity.
the method looks as it follows
public function findAllByCurrentDemands($ids) {
$query = $this->createQueryBuilder('pt')
->select('pt')
->where('pt.id IN (:ids)')
//->groupBy('pt.demand_id')
->setParameter('ids', $ids)
->getQuery()->getResult();
dump($query);
die;
}
the raw sql example which is working in console and should be transformed to doctrine
SELECT demand_id
FROM ProductType
WHERE id IN (313,315,317,320,321,765,761,763,766)
GROUP BY demand_id;
How can I do this in a doctrine query like holding the attached relations?