죄송합니다. 이것이 분명하다면 - 조인 테이블에서 find()를 시도하고 실패합니다. 올바른 구문은 무엇입니까?CakePHP가 조인 테이블에서 찾는다
기본적으로 나는 비용 표와 HABTM releationship이있는 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 주석을 제거합니다.
어디로 잘못 가고 있습니까? 미리 감사드립니다.
그래서 this-> ID를 일치하는 expense_code_ids가 없을 것? 구문이 정확 해 보이고 찾기가 작동하지만 적어도 하나의 결과가 발견됩니다. – Quinny