DESC) FROM player_season ps WHERE ps.season_id = :season SQL, $rsmBuilder); $query->setParameter(':season', $season->getId()); public function getLadder(Season $season) { $rsmBuilder = new ResultSetMappingBuilder($this->_em); $rsmBuilder->addRootEntityFromClassMetadata(PlayerSeason::class, 'ps'); $rsmBuilder->addScalarResult('rank', 1); $select = $rsmBuilder->generateSelectClause(['ps']); return $query->getResult(); }