我在CakePHP中創建了一個Q &應用程序,我想在某些情況下排除我的關聯。想象一下:如何從CakePHP中的關聯模型中排除記錄?
我使用$ this-> Question-> findAll();列出了第一頁上的所有問題。由於我在我的模型中有以下關聯:
public $hasMany = array('Answer' =>
array('className' => 'Answer',
'order' => 'Answer.created DESC',
'foreignKey' => 'post_id',
'dependent' => true,
'exclusive' => false,
)
);
所有答案都會在起始頁面中選中,這不是最佳選擇。我怎麼能排除在這個特定的方法的答案?
感謝