在symfony2中查找所有条件

Mic*_*ael 8 repository entitymanager findall symfony

有没有办法使用findAll()条件的功能?

我想做点什么

->findAll('active'=1);
Run Code Online (Sandbox Code Playgroud)

我知道我可以编写自定义存储库类,但只是为了一个简单的"where-condition"我认为有一种更简单的方法.

moo*_*e99 23

你可以使用findBy:

$objects = $yourRepo -> findBy(array('key' => $value ));
Run Code Online (Sandbox Code Playgroud)