試圖編輯多個模型編輯多個模型蛋糕PHP
的控制器
function edit($id = null) {
if (!empty($this->data)) {
$this->Qnote->save($this->data);
if ($this->Qnote->save($this->data)) {
$this->data['Step']['qnote_id'] = $this->Qnote->id;
$this->Step->save($this->data);
$this->Session->setFlash(__('The qnote has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The qnote could not be saved. Please, try again.', true));
}
}
<?php echo $this->Form->create();?>
<fieldset>
<legend><?php __('Edit Qnote'); ?></legend>
<?php
echo $this->Form->hidden('Qnote.id');
echo $this->Form->input('Qnote.subject');
echo $this->Form->input('Qnote.body');
echo $this->Form->hidden('Step.0.id');
echo $this->Form->Hidden('Step.qnote_id');
echo $this->Form->Hidden('Step.user_id');
echo $this->Form->input('Step.0.body');
?>
<?php echo $this->Form->end(__('Submit', true));?>
我想編輯和更新相關車型信息的形式,QNOTES和步驟 信息顯示在表單中。但是當我提交表格。
Qnote信息保存沒有任何問題。但是步驟信息未更新
模型已關聯。與步驟屬於Qnote,QNote有很多步驟