Record not delete in cake php
In cake php ,
if ($this->BanquetBillMaster->BanquetOtherBillMaster->del($this->data['BanquetOtherBillMaster']['id'])
{
$this->Session->setFlash(__('Menu type deleted successfully !', true));
$this->redirect(array('action'=>'add_other_items'));
exit();
}
same code开发者_开发知识库 use in another controller it works, but here its not working
anyone help me...
I think you have not added The required model in uses.Please check that first..
var $uses = array('Patient','User','StaticPage','Latestupdate','Member','Agent');
Since you're accessing the model from a controller, the same code may work in one controller, but not another.
For example
$this->BanquetBillMaster->BanquetOtherBillMaster->del()
This may work in your BanquetBillMasterController()
but not in your BanquetOtherBillMasterController()
(This depends on how you have your app set up, but generally this holds true.). This is because of the associations CakePHP builds up.
So, before calling $this->BanquetBillMaster->BanquetOtherBillMaster
make sure those models are available in the controllers you call.
精彩评论