Issues

ZF-7844: SETNULL option not provied in onUpdate or onDelete statements

Issue Type: Bug Created: 2009-09-14T09:06:57.000+0000 Last Updated: 2011-10-12T09:01:33.000+0000 Status: Open Fix version(s): Reporter: Christoph Rust (crust) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db_Table

Related issues: Attachments:

Description

If a reference map in zend db contains 'onDelete' => self::SET_NULL this is not executed in the database.

Comments

Posted by Matus Zeman (matuszemi) on 2011-02-28T05:08:21.000+0000

This was my quick fix: ZF 1.10.8 Zend_Db_Table_Abstract::_cascadeDelete() - line: 1190

<pre class="highlight">
                case self::SET_NULL:
                        $where = array();
                        $data = array();
                        
                        for ($i = 0; $i < count($map[self::COLUMNS]); ++$i) {
                            $col = $this->_db->foldCase($map[self::COLUMNS][$i]);
                            $refCol = $this->_db->foldCase($map[self::REF_COLUMNS][$i]);
                            $type = $this->_metadata[$col]['DATA_TYPE'];
                            $where[] = $this->_db->quoteInto(
                                $this->_db->quoteIdentifier($col, true) . ' = ?',
                                $primaryKey[$refCol], $type);
                                
                            $data[$col] = null;
                        }
                        
                        $rowsAffected += $this->update($data, $where);
                        break;

Posted by Maxim Postoronca (max4ever) on 2011-10-12T09:01:33.000+0000

this option is also missing from _cascadeUpdate in version 1.11.11

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