开发者

Zend db cascade delete multiple levels

开发者 https://www.devze.com 2023-01-18 19:06 出处:网络
How does one make Zend Db cascade delete multiple levels of th开发者_JAVA技巧e hierarchy? For example:

How does one make Zend Db cascade delete multiple levels of th开发者_JAVA技巧e hierarchy? For example:

dealers -> products -> attributes

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

Any thoughts?


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 here. It's worked for me in one cause but need to test more.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号