[php] Doctrine에서 findBy ()로 결과를 주문하는 방법

findBy()Doctrine 저장소 에서 메소드를 사용하고 있습니다 .

$entities = $repository->findBy(array('type'=> 'C12'));

결과를 어떻게 주문할 수 있습니까?



답변

의 두 번째 매개 변수 findBy는 ORDER입니다.

$ens = $em->getRepository('AcmeBinBundle:Marks')
          ->findBy(
             array('type'=> 'C12'), 
             array('id' => 'ASC')
           );


답변

$ens = $em->getRepository('AcmeBinBundle:Marks')
              ->findBy(
                 array(), 
                 array('id' => 'ASC')
               );


답변

$cRepo = $em->getRepository('KaleLocationBundle:Country');

// Leave the first array blank
$countries = $cRepo->findBy(array(), array('name'=>'asc'));


답변