selama ini ane pake cara ane sendiri, mau cobain pake aftersave sama before save nya yii. ada yang bersedia ngajarin atau paste salah satu code nya disini

thanks
Posted 04 October 2012 - 11:11 PM
Posted 08 October 2012 - 06:07 AM
public function beforeSave() { $this->invoicedate = date(Yii::app()->params['datetodb'], strtotime($this->invoicedate)); $this->amount = str_replace(",","",$this->amount); $this->rate = str_replace(",","",$this->rate); return parent::beforeSave(); }
kfahmi, on 04 October 2012 - 11:11 PM, said:
Posted 30 October 2012 - 11:37 PM
kfahmi, on 04 October 2012 - 11:11 PM, said:
public function afterSave() { $count = Buku::model()->countByAttributes(array('id_pengarang' => $this->id_pengarang)); $pengarang = Pengarang::model()->findByPk($this->id_pengarang); $pengarang->jumlah_buku = $count; $pengarang->save(); }