Home > Enterprise >  where in no result in doctrine query builder
where in no result in doctrine query builder

Time:09-10

hey i have problem with where in in doctrine and i search and query is exactly like this but it result always is empty. where in not works . what is the problem?

$qb = $this->connection->getQueryBuilder();
        $users = ['admin'];
        $result = $qb->select("*")
            ->from("users")
            ->where("groles IN (:groles)")
            ->setParameter('groles', $users)
            ->execute()
            ->fetchAll();

CodePudding user response:

Try with

use Doctrine\DBAL\Connection;

//....

->setParameter('groles', $users, Connection::PARAM_STR_ARRAY)
  • Related