<?php
/**
* This is the model class for table "{{public_posts}}".
*/
class PublicPost extends CActiveRecord {
/**
* @return string the associated database table name
*/
public function tableName() {
return '{{public_posts}}';
}
/**
* @return array validation rules for model attributes.
*/
public function rules() {
return array(
array('public_id, author_id, text', 'required'),
array('public_id, author_id, editor_id', 'length', 'max' => 10),
array('created_at, update_datetime', 'safe'),
);
}
/**
* @return array relational rules.
*/
public function relations() {
return array(
'public' => array(self::BELONGS_TO, 'CPublic', 'public_id'),
'author' => array(self::BELONGS_TO, 'User', 'author_id'),
'editor' => array(self::BELONGS_TO, 'User', 'editor_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 PublicPost the static model class
*/
public static function model($className=__CLASS__) {
return parent::model($className);
}
}