Doctrine partial queries return the complete object
问题 I'm trying to optimize the query as I need a simple list as an entity that is affiliated with several entities. So I created this query, you should just give me back the id and name: public function findAllOrderByName() { $qb = $this->createQueryBuilder('a'); $query = $qb->select(array('partial a.{id,name}')) ->addOrderBy('a.name', 'ASC') ->getQuery(); return $query->getResult(); } return it in the controller like this: public function getInstrumentsAction() { $instruments = $this-