public function add_comments($type, $type_no, $date_, $memo_) { if ($memo_ != null && $memo_ != "") { $comment = new PahComments(); $comment->type = $type; $comment->type_no = $type_no; $comment->date_ = $date_; $comment->memo_ = $memo_; if (!$comment->save()) { throw new Exception("Gagal menyimpan keterangan."); } } }
static function delete_comments($type, $type_no) { $criteria = new CDbCriteria(); $criteria->addCondition("type=" . $type); $criteria->addCondition("id=" . $type_no); $comment = PahComments::model()->find($criteria); $comment->delete(); }