public function testTranslatableWhereOnTranslatableCollectionWithArrayAndDifferentDefaultLocale() { $this->_translatableListener->setLocale($this->_languagePl); $this->_translatableListener->setDefaultLocale($this->_languageEn); $comment1 = new Comment(); $comment1->setId(1); $comment2 = new Comment(); $comment2->setId(2); $whereComments = array($comment1, $comment2); $qb = new QueryBuilder($this->_em); $qb->select('a'); $qb->from(self::ARTICLE, 'a'); $qb->addTranslatableWhere('a', 'comments', $whereComments); $this->assertEquals($this->normalizeDql(sprintf(' SELECT a FROM %s a LEFT JOIN a.translations atranslationspl WITH atranslationspl.locale = :atranslationsplloc LEFT JOIN a.translations atranslationsen WITH atranslationsen.locale = :atranslationsenloc LEFT JOIN atranslationspl.comments atranslationsplcommentsjoin LEFT JOIN atranslationsen.comments atranslationsencommentsjoin WHERE CASE WHEN atranslationspl.id IS NOT NULL AND atranslationsplcommentsjoin IN(:acommentsval) THEN TRUE WHEN atranslationsencommentsjoin IN(:acommentsval) THEN TRUE ELSE FALSE END = TRUE', self::ARTICLE)), $qb->getDQL()); $this->assertEquals($this->_languagePl, $qb->getParameter('atranslationsplloc')->getValue()); $this->assertEquals($this->_languageEn, $qb->getParameter('atranslationsenloc')->getValue()); $this->assertEquals($whereComments, $qb->getParameter('acommentsval')->getValue()); $qb->getQuery()->execute(); }