ZF-11459: Zend_Db_Table_Row_Abstract - __set does check against _data not columns.


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


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

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.