I want to delete all dependent rable record
My association
Branch Model
var $hasMany =array(
'Dealbranch' => array(
'className' => 'Dealbranch',
'foreignKey' => 'DLB_BR_ID',
'dependent' =>true
)
);
Dealbranch Model
var $belongsTo = array(
'Deal' => array(
'className' => 'Deal',
'foreignKey' => 'DL_ID',
'dependent' => true
),
'Branch' => array(
'className' => 'Branch',
'foreignKey' => 'DLB_BR_ID',
)
);
Deal Model
var $hasMany = array(
'Dealbranch' => array(
'className' => 'Dealbranch',
'foreignKey' => 'DLB_DL_ID',
)
);
In controller I have used
$this->Branch->delete($id,true);
Now here whem I am deleting branch , so dependent dealbranch deleted successfully but none of any deal record deleted
I want like : whem I am deleting branch , so all dependent dealbranch should be deleted and all dependent( depend on dealbranch) deal record should be deleted
here Deal is child of Dealbranch and Dealbranch is child of branch
Now, For one branch there are multiple record in Dealbranch, and for multiple Dealbranch there is one record in Deal
Please help me. I am using cakephp 2