Issues

ZF-12412: Zend_Db_Table_Abstract::delete does not delete from dependent table

Issue Type: Bug Created: 2012-09-09T22:17:38.000+0000 Last Updated: 2013-04-05T16:07:18.000+0000 Status: Closed Fix version(s): Reporter: Tomasz Zimnicki (tomz) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db_Table

Related issues: Attachments:

Description

Although cascade deleting is executed from Zend_Db_Table_Abstract::delete it will not delete from dependent table. While calling _cascadeDelete on dependent table it's class name is passed as parent's table. Zend_Db_Table_Abstract::delete should be:

<pre class="highlight">
    public function delete($where)
    {
        $depTables = $this->getDependentTables();
        if (!empty($depTables)) {
            $resultSet = $this->fetchAll($where);
            if (count($resultSet) > 0 ) {
                foreach ($resultSet as $row) {
                    /**
                     * Execute cascading deletes against dependent tables
                     */
                    foreach ($depTables as $tableClass) {
                        $t = self::getTableFromString($tableClass, $this);
                        $t->_cascadeDelete(get_class($this), $row->getPrimaryKey());
                    }
                }
            }
        }

        $tableSpec = ($this->_schema ? $this->_schema . '.' : '') . $this->_name;
        return $this->_db->delete($tableSpec, $where);
    }

Comments

Posted by Ralph Schindler (ralph) on 2013-04-05T16:07:18.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf1/issues/15

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts