我有2个表:table bien和table disponibilite。我想检索表Bien的id并将其自动放入表disponibilite但它不起作用。 这是我的代码
public function add($id = null ) {
$this->loadModel("Bien");
$biens = $this->Disponibilitebien->Bien->find('list', array('conditions'=>array('Bien.idBien'=>$id)));
$this-> set('biens',$biens);
if ($this->request->is('post')) {
$this->Disponibilitebien->create();
if ($this->Disponibilitebien->save($this->request->data)) {
$this->Flash->success(__('The disponibilitebien has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
$this->Flash->error(__('The disponibilitebien could not be saved. Please, try again.'));
}
}
}
答案 0 :(得分:0)
id等于
cycle-snabbdom
或
$biens['Bien']['id'];