我试图重写" Easy"选择学说:
原始查询:
SELECT * FROM User WHERE value % 200 = 0;
,但在学说中它不起作用。我在学说中有此代码:
$queryBuilder = $this->createQueryBuilder('u');
$queryBuilder->where('u.value%200=0');
今年秋天为:
QueryException: [Syntax Error] line 0, col 255: Error: Expected =, <, <=, <>, >, >=, !=, got '%'
是否有机会将%
用作操作员?或存在任何功能以实现这一目标?
谢谢!
我的解决方案:
$queryBuilder = $this->createQueryBuilder('u');
$queryBuilder->where('mod(u.value,200)=0');
效果很好!