2009年11月17日星期二

[fw-db] Zend_Db_Table_Row strange behavior

Hi all,

I could not find an open issue about this and could not find similar
messages on the list, but forgive me if this is a duplicate of anything
mentioned earlier.

I have a unit test that tests a dataobject class and it uses a
Zend_Db_Table_Row to do updates/inserts.

The strange thing is that after setting a few properties and calling
->save(), one of the column indexes (the last one) is replaced with the
tablename....

This is so strange that I thought you guys would be all over the list
screaming out in anger, but since you are not, I am probably doing
something wrong myself. If not, I will be happy to file an issue and try
to fix it.

This is the code:
$this->DataObject->code = 11;
$this->DataObject->naam = 'testnaam';
$this->DataObject->volgnr = 12;
$this->assertTrue($this->DataObject->save());

This works.
But after that, if I var_dump $this->_row inside the DataObject, I get this:

["_cleanData:protected"]=>
array(3) {
["code"]=>
string(2) "11"
["naam"]=>
string(8) "testnaam"
["regio"]=>
string(2) "12"
}

The last index should have been 'volgnr', not 'regio', the latter being
the name of the table.....

How's that for weird?

If I try to save again, I get the message that volgnr is not in the
column list (obvious).

Anyone come to the rescue here?

Regards,

Bart McLeod

没有评论: