If you look at model's source code for 1.11 you have something like:
function del() {
// ...
if ($this->id && $db->delete($this)) {
$this->_deleteMulti($id);
$this->_deleteHasMany($id, $cascade);
$this->_deleteHasOne($id, $cascade);
//...
}
}
Then for example deleteHasOne():
function _deleteHasOne($id, $cascade) {
// ...
foreach($this->hasOne as $assoc => $data) {
if ($data['dependent'] === true && $cascade === true) {
$model =& $this->{$data['className']};
// ...
if($records != false){
foreach($records as $record) {
$model->del($record[$data['className']][$model->primaryKey]);
}
}
}
}
//...
}
}
So (with the exception of deleteMulti() that issues direct SQL delete
statements), each related record when in cascade will issue another del()
call. So it can go as far as your PHP execution time allows it to go.
-MI
---------------------------------------------------------------------------
Remember, smart coders answer ten questions for every question they ask.
So be smart, be cool, and share your knowledge.
BAKE ON!
blog: http://www.MarianoIglesias.com.ar
-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de Langdon Stevenson
Enviado el: Domingo, 18 de Febrero de 2007 10:59 p.m.
Para: [email protected]
Asunto: Re: How many levels will del with cascade go?
I am tackling the same issue and would also like to know the best
approach.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---