相关疑难解决方法(0)

doctrine2 findby两列OR条件

我的行动:

   $matches_request = $em->getRepository('Bundle:ChanceMatch')->findByRequestUser(1);
   $matches_reply = $em->getRepository('Bundle:ChanceMatch')->findByReplyUser(1);
Run Code Online (Sandbox Code Playgroud)

是否可以or使用getRepository 加入查询条件,例如.

$matches_reply = $em->getRepository('FrontendChancesBundle:ChanceMatch')->findBy(array('requestUser' => 1, 'replyUser' => 1); 
//this of course gives me the a result when `requestUser` and `replyUser` is `1`. 
Run Code Online (Sandbox Code Playgroud)

我的桌子

id | requestUser | replyUser
....
12 |      1      |     2
13 |      5      |     1
Run Code Online (Sandbox Code Playgroud)

我的查询应该返回id 12 & 13.

感谢帮助!

symfony doctrine-orm symfony-2.1

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

doctrine-orm ×1

symfony ×1

symfony-2.1 ×1