How to sort findAll Doctrine's method?

前端 未结 12 2130
闹比i
闹比i 2020-12-23 00:14

I\'ve been reading Doctrine\'s documentation, but I haven\'t been able to find a way to sort findAll() Results.

I\'m using symfony2 + doctrine, this is the statemen

12条回答
  •  旧巷少年郎
    2020-12-23 00:42

    You need to use a criteria, for example:

    >, null, null );
    
            $rep    = $this->getDoctrine()->getManager()->getRepository('Bundle:Thing');
            $things = $rep->matching($criteria);
            return $this->render('Bundle:Thing:things.html.twig', [
                'entities' => $things,
            ]);
        }
    }
    

提交回复
热议问题