我正在使用Doctrine存储库上的findBy()
方法:
$entities = $repository->findBy(array('type'=> 'C12'));
我该如何对结果进行排序?
我正在使用Doctrine存储库上的findBy()
方法:
$entities = $repository->findBy(array('type'=> 'C12'));
我该如何对结果进行排序?
$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'));
array('priority'=>'ASC','id'=>'ASC')
。 - Aaron BelchamberfindBy
用于基本查询场景,对于更复杂的场景,请使用 query。例如$qb = $em->getRepository('AcmeBinBundle:Marks')->createQueryBuilder('m')->...
。 - xdazz