Symfony 2 Doctrine find by ordered array of id Symfony 2 Doctrine find by ordered array of id symfony symfony

Symfony 2 Doctrine find by ordered array of id


You can use it like:

$cardRepository->findBy( array('id' => $idsArray), array('id' => 'DESC') );

Check also the official doctrine documentation for more details on how to use ordering, limit and offset as second to fourth parameters in the findBy method.


You can create a helper table, where you store ordered group elements, having the following data: (group_id, card_id, order)

You search by group_id, order by order and read the card_id.