主义时差

时间:2016-05-10 07:42:20

标签: php symfony doctrine-orm dql

SELECT count(a) FROM Entity a WHERE
     (a.timeFrom <= a.timeTo AND :start_time BETWEEN a.timeFrom AND a.timeTo)
     OR (a.timeTo >= a.timeFrom AND :end_time NOT BETWEEN a.timeTo AND a.timeFrom) 
     AND a.confirm = 1

注意:我需要检查getSql();上两个时间字段之间的时隙是否可用,它会返回类似这样的内容

SELECT count(m0_.id) AS sclr_0 FROM table_name m0_ 
WHERE (m0_.time_from = m0_.time_from 
          AND ? NOT BETWEEN m0_.time_to 
          AND m0_.time_from) 
      AND m0_.confirm = 1

它在OR运算符

之后转义参数

0 个答案:

没有答案