简体   繁体   中英

where in no result in doctrine query builder

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();

Try with

use Doctrine\DBAL\Connection;

//....

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM