andWhere('.id IN (:ids)') ->setParameter('ids', $ids) ; } public function withEstablishment(?Establishment $establishment): self { if (!$establishment) { return $this; } $keyEstablishment = 'k'.mt_rand(); $keyId = 'id'.mt_rand(); return $this ->innerJoin('.establishments', $keyEstablishment) ->andWhere($keyEstablishment.'.id = :'.$keyId) ->setParameter($keyId, $establishment->getId()) ; } protected function filterHandler(string $name, $value) { if ('establishment' === $name) { return $this->withEstablishment($value); } } }