<?php
/**
* This is the model class for table "{{forums}}".
*/
class Forum extends CActiveRecord {
public function behaviors() {
return array(
'SortableModel' => array('class' => 'ext.SortableModel.SortableModelBehavior'),
);
}
/**
* @return string the associated database table name
*/
public function tableName() {
return '{{forums}}';
}
/**
* @return array validation rules for model attributes.
*/
public function rules() {
return array(
array('name', 'required'),
array('name', 'length', 'max' => 255),
// The following rule is used by search().
array('id, name', 'safe', 'on' => 'search'),
);
}
/**
* @return array relational rules.
*/
public function relations() {
return array(
'sections' => array(self::HAS_MANY, 'ForumSection', 'forum_id'),
);
}
/**
* Returns the static model of the specified AR class.
* Please note that you should have this exact method in all your CActiveRecord descendants!
* @param string $className active record class name.
* @return Forum the static model class
*/
public static function model($className=__CLASS__) {
return parent::model($className);
}
}