Issue Type: Bug Created: 2011-06-09T11:39:18.000+0000 Last Updated: 2012-05-12T01:09:08.000+0000 Status: Closed Fix version(s): Reporter: Mubble Jubble (mubble.jubble) Assignee: Adam Lundrigan (adamlundrigan) Tags: - Zend_Db_Table
Related issues: Attachments:
Zend_Db_Table_Row_Abstract - __set does check against _data not columns. If createRow() is used (as specified in documentation) with not parameters (e.g. data array) - when trying to set a _data value at a later stage using __set($columnName, $value) results in a 'Zend_Db_Table_Row_Exception: Specified column "XXX" is not in the row' exception.
$obj = $table->createRow();
//exception - testValue is not in the row $obj->testValue = "x"; //e.g. $obj->__set("testValue", "x");
I think the check should be against the column metadata, not the data array - as this might not be populated yet. This was mentioned in 2007 in a ticket about default values - although I dont think the issue is directly related anyway.
http://zendframework.com/issues/browse/… Comment to look at: B. Charbonneau added a comment - 09/Nov/07 9:45 PM
Posted by Mubble Jubble (mubble.jubble) on 2011-06-09T11:47:57.000+0000
PS - this was on a field without a default value... it did work on those with defaults set. __set seems to work for fields with defaults set.
e.g. in SQL: testValue varchar(30) NOT NULL
Posted by Mubble Jubble (mubble.jubble) on 2011-06-09T12:19:06.000+0000
I have found the causing issue in my own code:
I inadvertently used an unset() to delete stored data as part of the business logic in my extended row class ( unset($this->testValue)) - this assumed that sets are checked by column metadata as opposed to checking the _data array (current imp). This call removed the column $key from _data - this causing the exception.
Have you found an issue?
See the Overview section for more details.