2008年12月18日星期四

[fw-db] Pulling "enhanced" Table/Row objects from Cache

Hey all,

I've been working on caching the results of a lot of my queries. I am
running into problems when pulling these objects from cache and then
"re-connecting" them using $obj->setTable(new MyTable()).

I get the following error:

The specified Table does not have the same columns as the Row

I know why this is happening. I "enhance" my rows with translated
columns. In my custom row, I translate some values (bit values into
english, etc), but don't put them back into the same column because
there is need for both at times. So I create an additional column in
the $this->_data array from within the MyRow->init() method. This
worked great until I started storing them in the cache. Now, I cannot
"re-connect" them without the above error (thrown in
Zend_Db_Table_Row_Abstract::setTable -- line 336).

So what is the purpose of that check? Is it simply a sanity check?
And if so, how can I get around it or suppress it? How vital is that
check?

Thanks,
-=Dan

没有评论: