我調用這個在我的控制器:Cakephp 2.5。使用綁定時收到錯誤/解除綁定
public function index() {
$this->Product->recursive = 2;
$this->Product->unbindModel(array('hasMany' => array('Productproperty')), true);
$this->Product->Ranking->unbindModel(array('belongsTo' => array('Product', 'Contacts')), true);
$this->Product->Ranking->bindModel(array('belongsTo' => array('Customer' => array('foreignKey' => false))), true);
$this->set('products', $this->Paginator->paginate());
}
我得到我想要的日期,該聲明是正確的調試中。 數據輸出對我來說是正確和完美的。
但我得到這個錯誤信息在屏幕上:
爲的foreach()供給無效參數 [CORE \蛋糕\模型\數據源\ DboSource.php,線1695]
我想知道爲什麼涉及dboSource? 任何想法是什麼錯?
如果你看看產生錯誤的代碼行 - 它可能是'false'。將sql日誌添加到問題將有所幫助。你最好使用可容納的問題。 ''''''''''''''''''''''''''''如果沒有條件(?)會導致無意義的結果 – AD7six