[php] How to order results with findBy() in Doctrine

I am using the findBy() method on a Doctrine repository:

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

How can I order the results?

This question is related to php doctrine-orm

The answer is


$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'));