2015-12-28 38 views
1

我提出一個問題,較早前:php zf2 select where clause with SQL functionPHP ZF2多個地方

但我回來了,因爲我仍然得到同樣的問題。我可能是「愚蠢的」,但我真的不明白爲什麼,它讓我感到沮喪,無法實現太簡單的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. "'"); 

我真的很感激你的幫助,瞭解發生了什麼事,以及如何得到這個騎。

回答