Просмотр файла vkclone-0.0.1/protected/models/TopicPostVersion.php

Размер файла: 1.19Kb
<?php
/**
 * This is the model class for table "{{forum_section_topic_post_versions}}".
 */
class TopicPostVersion extends CActiveRecord {

	/**
	 * @return string the associated database table name
	 */
	public function tableName() {
		return '{{forum_section_topic_post_versions}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules() {
		return array(
			array('post_id, diff', 'required'),
			array('post_id, author_id', 'length', 'max' => 10),
			// The following rule is used by search().
			array('id, post_id, author_id, created_at, diff', 'safe', 'on' => 'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations() {
		return array(
			'post' => array(self::BELONGS_TO, 'TopicPost', 'post_id'),
			'author' => array(self::BELONGS_TO, 'User', 'author_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 TopicPostVersion the static model class
	 */
	public static function model($className=__CLASS__) {
		return parent::model($className);
	}
}