request with multiple id Symfony2 Doctrine

You can also get it directly from repository:

$em->getRepository('YourRepo')->findById(array(1,2,3,4,5));

Also you can pass parameters in get no tin array, but in simple string glued by commas

?ids=1,2,3,4,56

And after that get it from $request

$em->getRepository('YourRepo')->findById(explode(',', $request->get('ids'));

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)