views:

18

answers:

1

How does one make Zend Db cascade delete multiple levels of the hierarchy? For example:

dealers -> products -> attributes

deleting one dealer should go all the way down to attributes, and now it doesn't :(

Any thoughts?

A: 

On row of the Zend_Table_Abstract within the function _cascadeDelete a row is constructed like this:

$rowsAffected += $this->delete($where);
It should instead be constructed as something like this:

$toDelete = $this->fetchAll($where);
foreach($toDelete as $row) {
$rowsAffected += $row->delete();
}

more info at http://framework.zend.com/issues/browse/ZF-1103
It's worked for me in one cause but need to test more

Behrang