例如,我有一个包含 fromH 和 toH 字段的 Store 模型,我想从数据库中检索在给定时间 (@t) 开放的商店。
SQL 查询看起来像这样
select *
from store
where
( fromH < toH and @t between fromH and toH ) or
( fromH > toH and
(@t between fromH and 24 OR
(@t between 1 and toH )
)
如何在 cakephp 中实现此查询,条件数组的外观如何?我想做蛋糕风格。