/** * Saves attributes into database */ public function save() { $widget = SystemWidgets::model()->findByPk($this->id); if (!$widget) { $widget = new SystemWidgets(); } $widget->attributes = $this->attributes; $widget->setParams(array('width' => $this->width, 'height' => $this->height, 'banner_id' => $this->banner_id)); $widget->save(); }