开发者

Zend_Db_Table_Abstract - update?

开发者 https://www.devze.com 2023-01-27 17:10 出处:网络
we have this on Zend Manual: $table = new Bugs(); $data = array( \'updated_on\'=> \'2007-03-23\', \'bug_status\'=> \'FIXED\'

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

精彩评论

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

关注公众号