我正在尝试使用DoctrineJsonFunctions来过滤用户表的角色列。
我已按照文档进行操作并寻求帮助,但找不到解决我的问题的方法。
我已经DoctrineJsonFunctions正确安装了。
UserRepository我在我的函数中创建了一个函数
public function findByRole(string $role)
{
$em = $this->getEntityManager();
$qb = $em->createQueryBuilder();
$qb
->select('u')
->from('App:User', 'u')
->where("JSON_GET_TEXT(user.roles, 'role') = :role")
->setParameter('role', $role)
->getQuery()
->getResult();
}
Run Code Online (Sandbox Code Playgroud)
但我遇到了这个错误:
预期的已知函数,得到“JSON_GET_TEXT”
有谁知道为什么并可以帮助我解决它?