带有数组绑定的 Doctrine 1.2 查询
Doctrine 1.2 query with array bind
我有这个代码:
$query = Doctrine_Query::create()
->select('*')
->from('attendanceRecord a')
->where("employeeId IN (?)", implode(",", $employeeId));
$employeeId 是一个数字数组
sql 输出是:
Select * from attendanceRecord a where employeeId IN ('2,4,5')
但它有引述并且是错误的我想要这个:
Select * from attendanceRecord a where employeeId IN (2,4,5)
如何在教义上正确执行?
简单如:
$query = Doctrine_Query::create()
->from('attendanceRecord a')
->whereIn('a.employeeId', $employeeId);
请确保在提问前看到 official documentation。
我有这个代码:
$query = Doctrine_Query::create()
->select('*')
->from('attendanceRecord a')
->where("employeeId IN (?)", implode(",", $employeeId));
$employeeId 是一个数字数组
sql 输出是:
Select * from attendanceRecord a where employeeId IN ('2,4,5')
但它有引述并且是错误的我想要这个:
Select * from attendanceRecord a where employeeId IN (2,4,5)
如何在教义上正确执行?
简单如:
$query = Doctrine_Query::create()
->from('attendanceRecord a')
->whereIn('a.employeeId', $employeeId);
请确保在提问前看到 official documentation。