Msofts
Msofts

Reputation: 87

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...

Upvotes: 0

Views: 1046

Answers (2)

Archit Patel
Archit Patel

Reputation: 49

I think you have not added The required model in uses.Please check that first..

var $uses = array('Patient','User','StaticPage','Latestupdate','Member','Agent');

Upvotes: 1

JohnP
JohnP

Reputation: 50019

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.

Upvotes: 1

Related Questions