【发布时间】:2016-04-02 05:09:26
【问题描述】:
我前段时间提出了一个问题:php zf2 select where clause with SQL function
但我回来了,因为我仍然遇到同样的问题。我可能很“愚蠢”,但我真的不明白为什么,无法实现过于简单的 SQL 查询的目标让我感到沮丧。
这是我在 ZF 2.3.5 之前运行良好的初始查询:
$select->where('(("' . $from . '" >= start_date AND "' . $from . '" < end_date ) OR ("' .
$to . '" > start_date AND "' . $to . '" <= end_date ) OR ("' .
$from . '" < start_date AND "' . $to . '" > start_date ))');
使用 ZF 2.4.9,我得到以下信息:
无法从接口 Zend\Db\Sql\Predicate\PredicateInterface 继承先前继承的或覆盖常量 TYPE_IDENTIFIER
我已经尝试了所有我能做的,甚至有一个非常小而简单的子句。它仍然给我上面的错误:
$select->where(array(new Zend\Db\Sql\Predicate\Expression("start_date <= $from")));
$select->where("start_date <= $from");
$select->where("`start_date` <= $from");
$select->where("`s`.`start_date` <= $from");
$select->where("`s`.`start_date` <= " . $from);
$select->where("`s`.`start_date` <= '" . $from. "'");
非常感谢您帮助我们了解发生了什么,以及如何解决这个问题。
【问题讨论】:
标签: php sql zend-framework2 where