public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('name, pid, ctime', 'required'),
array('pid, ctime', 'numerical', 'integerOnly'=>true),
array('name', 'length', 'max'=>50),
array('status', 'length', 'max'=>1),
array('name', 'unique'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, name, pid, ctime, status', 'safe', 'on'=>'search'),
);
}
array('字段名','unique') ,可以防止重复的字段内容插入