여러 모델 연관에 데이터를 저장하려하지만 동일하게 저장하지 않습니다. 모두 올바르게 설정되었습니다. 즉, 양식의 데이터가 확인 (디버그가 모두 표시됨)되어 데이터를 가져 오지만 문제가있는 곳을 이해할 수 없습니다. 내 코드는 다음과 같이Cakephp 데이터는 다중 모델 연관에 저장하지 않습니다.
컨트롤러 :
if($url == "expense_reports") { $this->set('tab_content','Invoice - Expense Reports'); $this->render('/job/invoice2');
if($this->request->is('post'))
{//debug($this->data);
$this->Event->Invoice->Expense->save($this->data); }
}
모델 (협회) :
이벤트
public $belongsTo = array(
'EventType' => array(
'className' => 'AgencyCalendar.EventType',
'foreignKey' => 'event_type_id'
)
);
public $hasMany = array(
'Invoice' => array(
'className' => 'AgencyCalendar.Invoice',
'foreignKey' => 'event_id',
'dependent' => false
)
);
송장
public $belongsTo = array(
'Event' => array(
'className' => 'AgencyCalendar.Event',
'foreignKey' => 'event_id'
)
);
public $hasMany = array(
'Expense' => array(
'className' => 'AgencyCalendar.Expense',
'foreignKey' => 'invoice_id',
'dependent' => false
)
);
나는 또한 실제로 무슨 일이 일어나고 있는지 알아이 특정 작업에 대한 내 관점에서 모든 SQL 덤프를 받고 있지 않다
public $belongsTo = array(
'Invoice' => array(
'className' => 'AgencyCalendar.Invoice',
'foreignKey' => 'invoice_id'
)
);
비용. 또한 비용 조회에서 생성되는 여러 행을 어떻게 저장할 수 있습니까? 내 경비보기는 사용자 지정 URL이므로 SQL 덤프를 표시하지 않는 원인이 될 수도 있고 데이터를 저장하지 않을 수도 있습니다. 내가 뭘 잘못하고 있는지 알려주시겠습니까?