开发者

Zend_Db_Table_Abstract - update?

we have this on Zend Manual:

$table = new Bugs();

      $data = array(
       'updated_on'      => '2007-03-23',
       'bug_status'      => 'FIXED'
      );
$where = $table->getAdapter()->quoteInto('bug_id = ?', 1234);
$table->update($data, $where);

Why do we need getAdapter开发者_Python百科 and quoteInto again? I've read the manual but I don't understand.

What about the save() method, shouldn't we use it instead?

Regards, MEM


save() is for when you are using Zend_Db_Table_Row if you are using Zend_Db_Table only, update is the method.

The code you've pasted needs to have the getAdapter and quoteInfo because $table is an instance of Bugs but not necessarily Zend_Db_Table_Row or Zend_Db_Table, therefore it isn't connected to the db.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜