Cannot select entity through identification variables without choosing at least one root entity alias
问题 Ads entity is described by geographic information: Country> Region>County . The Ads entity is only linked with County . Consequently, retrieving Ads by countries will require us joining entities twice. My goal is counting the number of Ads for a given country. For that, I tried this DQL query but without success: public function getMotorsAdsCountByCountry($slug){ $qb = $this->_em->createQueryBuilder() ->select("m.id, COUNT(m.id) AS cnt") ->from("MinnAdsBundle:MotorsAds", "m") ->join("m.county