Bir satır güncellemek için özel mantık

0 Cevap php

Ben bu tablo sınıf vardır:

class Songs extends Zend_Db_Table_Abstract
{
    protected $_name = 'songs';
    protected $_primary = 'song_id';
    protected $_rowClass = 'Song';
}

Ve bazı özel mantık yukarıda sınıfını genişleten bir sınıf.

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?
    }
}

Benim sorunum yeni bir satır ekleme olduğumda benim özel mantık içinde $ this kullanabilirsiniz olmasıdır.

$row->save(); // $this exists in _insert()

Ben satır güncellemek için çalışıyorum ama zaman yok.

$myRow->update($data, $where); // $this does not exists in _update()

Neden bir satır güncellemeden önce bazı özel mantık yapmak istediğinizde bu yok $ mı?

0 Cevap