2009年12月1日星期二

Re: [fw-db] Select - insert Zend_Db_Row

This error happened to me one, when i wrote a Row class extending Zend_Db_Row_Abstract and i forgot to put "return parent::insert($data)".

Without parent's calls, the row cannot refresh itself as it does not have the new inserted ID.



On Sat, Nov 28, 2009 at 9:23 PM, umpirsky <umpirsky@gmail.com> wrote:

Hi.

I tried (in my class which extends Zend_Db_Table_Abstract):

$row = $this->find($id)->current();
$row->setTable(new My_Model_History());
$row->save();

My_Model_History and current class have same mysql structure, identical
tables, one is active, and other I want to use for data history.

I got:

Zend_Db_Table_Row_Exception: Cannot refresh row as parent is missing
thrown in Zend\Db\Table\Row\Abstract.php on line 758

It works with:

$row = $this->find($id)->current();
$history = new My_Model_CarHistory();
$history->insert($row->toArray());

Is there a way to do it with sth similar to 1st example, or there is maybe
some other better option?

Regards,
Sasa Stamenkovic.
--
View this message in context: http://n4.nabble.com/Select-insert-Zend-Db-Row-tp930493p930493.html
Sent from the Zend DB mailing list archive at Nabble.com.



--
Xavier Vidal Piera
Enginyer Tècnic Informàtic de Gestió
Tècnic Especialista Informàtic d'equips
xavividal@gmail.com
610.68.41.78

没有评论: