Answer the question
In order to leave comments, you need to log in
How to use an array to search in findBy in Symfony?
You need to search for a large number of user ids
documentUserRepository->findBy(['user' => [...], 'account' => $this->account, 'document' => $document]);
Answer the question
In order to leave comments, you need to log in
class DocumentUserRepository extends EntityRepository
{
public function findByUserAccountDocument(array $users, $account, $document)
{
return $this->createQueryBuilder('a')
->andWhere('a.user IN (:users)')->setParameter('users', $users)
->andWhere('a.account = :account')->setParameter('account', $account)
->andWhere('a.document = :document')->setParameter('document', $document)
->getQuery()->getResult();
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question