2選擇成員,我有兩個實體一對多和多對一關係學說使用收集
條具有一對多標籤
ArticleTag有多對一文章
$articleTags = $em->getRepository('Model\ArticleTag')
->findBy(array('article' => $articleId));
$qb->select('a')
->from('\\Model\\Article', 'a')
->where(':tags MEMBER OF a.tags')
->setParameter('tags', $articleTags);
該查詢返回錯誤:
An exception occurred while executing
SELECT .. FROM article a0_ WHERE EXISTS (SELECT 1 FROM article_tag a1_ WHERE a0_.id = a1_.article_id AND a1_.id = ?, ?, ?)' with params {"1":8,"2":9,"3":10}
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 9, 10)' at line 1
它有任何使用'in''instead'='in expression'a1_.id =?,?,?'