これが明らかな場合は申し訳ありません-結合テーブルでfind()を実行しようとして失敗しましたが、これを実行するための正しい構文は何ですか?
基本的に、私は経費テーブルとのHABTM関係を持つexpenseCodeテーブルを持っています。
私のexpenseCodeモデルには次のものがあります。
public function beforeDelete($cascade = false) {
$count = $this->Expense->find("count", array(
'conditions' => array('expense_code_id' => $this->id)
));
if ($count == 0) {
return true;
} else {
//$this->Session->setFlash('Record cannot be deleted as it has ' . $count . 'number of expenses attached to it');
return false;
}
}
setFlash()のコメントを外すと、エラーが発生します。
どこが間違っているのですか?前もって感謝します。