/** * Updates a particular model. * @param integer $id the ID of the model to be updated */ public function actionUbah($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); $supplierBarang = new SupplierBarang('search'); $supplierBarang->unsetAttributes(); $supplierBarang->setAttribute('barang_id', '=' . $id); $hargaJual = new HargaJual('search'); $hargaJual->unsetAttributes(); $hargaJual->setAttribute('barang_id', '=' . $id); $rrp = new HargaJualRekomendasi('search'); $rrp->unsetAttributes(); $rrp->setAttribute('barang_id', '=' . $id); if (isset($_POST['Barang'])) { $model->attributes = $_POST['Barang']; if ($model->save()) { $this->redirect(array('view', 'id' => $id)); } } $this->render('ubah', array('model' => $model, 'supplierBarang' => $supplierBarang, 'listBukanSupplier' => $this->_listBukanSupplier($id), 'hargaJual' => $hargaJual, 'rrp' => $rrp)); }