我正在使用Doctrine的QueryBuilder來(lái)構(gòu)建查詢,并且我想從查詢中獲取結(jié)果的總數(shù)。$repository = $em->getRepository('FooBundle:Foo');$qb = $repository->createQueryBuilder('n') ->where('n.bar = :bar') ->setParameter('bar', $bar);$query = $qb->getQuery();//this doesn't work$totalrows = $query->getResult()->count();我只想對(duì)此查詢進(jìn)行計(jì)數(shù)以獲取總行,但不返回實(shí)際結(jié)果。(在此計(jì)數(shù)查詢之后,我將使用maxResults進(jìn)一步修改查詢以進(jìn)行分頁(yè)。)
在教義QueryBuilder中計(jì)算行數(shù)
ibeautiful
2019-10-08 10:17:22