Open
Description
I got this error
QueryBuilder: [Semantical Error] line X, col X near 't.other IN(':
Error: 't' is not defined.
With the following code:
if (empty($things) && empty($others)) {
return [];
}
$qb = $this->createQueryBuilder('s');
$condition = $qb->expr()->orX();
if (!empty($things)) {
$condition->add('s.thing IN(:things)');
$qb->setParameter('things', $things);
}
if (!empty($others)) {
$condition->add('t.other IN(:others)');
$qb
->addSelect('t')
->join('s.thing', 't')
->setParameter('others', $others)
;
}
$qb->andWhere($condition);
return $qb->getQuery()->getResult();
Metadata
Metadata
Assignees
Labels
No labels