简体   繁体   English

在 doctrine 查询生成器中没有结果

[英]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.嘿,我对 doctrine 的where in疑问,我搜索和查询完全一样,但结果总是为空。 where in not works. where in不起作用。 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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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