我有這樣的表類:自定義邏輯更新一行
class Songs extends Zend_Db_Table_Abstract
{
protected $_name = 'songs';
protected $_primary = 'song_id';
protected $_rowClass = 'Song';
}
和延伸上面一些自定義的邏輯類的類。
class Song extends Zend_Db_Table_Row_Abstract
{
protected function _insert()
{
print_r($this);
// $this does exist
}
protected function _update()
{
print_r($this);
//$this does not existing when updating a row, why not?
}
}
我的問題是,當我插入新行我可以在我的自定義邏輯使用$此。
$row->save(); // $this exists in _insert()
但是,當我試圖更新一行時,它不存在。
$myRow->update($data, $where); // $this does not exists in _update()
爲什麼$當我想更新行之前做一些自定義邏輯這不存在?
我猜測,而不是'print_r($(this));'你的意思是'print_r($ this)'? – 2010-11-04 21:58:48