Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

findAll with conditions in symfony2

is there a way to use the findAll() function with conditions?

I want to do something like

->findAll('active'=1);

I know that i can write custom repository classes but just for a simple "where-condition" I thought there is an easier way.

like image 867
Michael Avatar asked Feb 07 '13 10:02

Michael


1 Answers

You can use findBy:

$objects = $yourRepo -> findBy(array('key' => $value ));
like image 167
moonwave99 Avatar answered Sep 30 '22 07:09

moonwave99