model() public static method

Returns the static model of the specified AR class.
public static model ( string $className = __CLASS__ ) : AttributeGroupDescription
$className string active record class name.
return AttributeGroupDescription the static model class
 public function actionUpdate($id)
 {
     $model = new AttributeGroupForm();
     if (isset($_POST['AttributeGroupForm'])) {
         $model->attributes = $_POST['AttributeGroupForm'];
         if ($model->validate()) {
             $model->save();
             $this->redirect(array('index'));
         }
     } else {
         $model->loadDataFromAttributeGroup($id);
     }
     $groups = CHtml::listData(AttributeGroupDescription::model()->findAll(), 'attribute_group_id', 'name');
     $this->render('update', array('model' => $model, 'groups' => $groups));
 }
Example #2
0
 public function afterDelete()
 {
     // delete dependencies
     AttributeGroupDescription::model()->deleteAll("attribute_group_id={$this->cacheId}");
     parent::afterDelete();
 }