user825904 user825904 - 1 year ago 119
PHP Question

How to order results with findBy() in Doctrine

I am using the

method on a Doctrine repository:

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

How can I order the results?

Answer Source

The second parameter of findBy is for ORDER.

$ens = $em->getRepository('AcmeBinBundle:Marks')
             array('type'=> 'C12'), 
             array('id' => 'ASC')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download