我对 Cakephp 很陌生'我试图获取发布数据并更新发票表。但是我应该从 post 数据中获取医生 ID 的值,并从医生表和更新发票表中获取与医生 ID 相关的推荐费。
我尝试使用此代码但没有用。请帮帮我。
if ($this->request->is('post')) {
$this->Invoice->create();
if ($this->Invoice->save($this->request->data)) {
$refid = $this->request->data['Invoice']['refid'];
print_r($refid);
$doctor = $this->Doctor->findById($refid);
$rfee = $doctor['Doctor']['rfee'];
$invoice_number = $this->request->data['Invoice']['invoice_number'];
$invoice = $this->Invoice->findByInvoiceNumber($invoice_number);
$invoice_id = $invoice['Invoice']['id'];
$this->Invoice->id = $invoice_id;
$this->Invoice->save('refee', '200');
$this->Session->setFlash('Invoice Successfully Added');
$this->redirect(array('controller' => 'invoices', 'action' => 'edit', $invoice_id));
} else {
$this->Session->setFlash('Unable To Add Invoice');
}
}