<?php

/**
 * This is the model base class for the table "mzgttiposlibros".
 * DO NOT MODIFY THIS FILE! It is automatically generated by giix.
 * If any changes are necessary, you must set or override the required
 * property or method in class "Mzgttiposlibros".
 *
 * Columns in table "mzgttiposlibros" available as properties of the model,
 * followed by relations of table "mzgttiposlibros" available as properties of the model.
 *
 * @property integer $PK_MZGTTIPOSLIBROS
 * @property string $MZGTTIPOSLIBROS_DESCRIPCION
 * @property string $MZGTTIPOSLIBROS_CODIGO
 * @property integer $MZGTTIPOSLIBROS_ESTADO
 *
 * @property Mzgtlibros[] $mzgtlibroses
 */
abstract class BaseMzgttiposlibros extends GxActiveRecord {

	public static function model($className=__CLASS__) {
		return parent::model($className);
	}

	public function tableName() {
		return 'mzgttiposlibros';
	}

	public static function label($n = 1) {
		return Yii::t('app', 'Mzgttiposlibros|Mzgttiposlibroses', $n);
	}

	public static function representingColumn() {
		return 'MZGTTIPOSLIBROS_DESCRIPCION';
	}

	public function rules() {
		return array(
			array('MZGTTIPOSLIBROS_ESTADO', 'required'),
			array('MZGTTIPOSLIBROS_ESTADO', 'numerical', 'integerOnly'=>true),
			array('MZGTTIPOSLIBROS_DESCRIPCION', 'length', 'max'=>255),
			array('MZGTTIPOSLIBROS_CODIGO', 'length', 'max'=>10),
			array('MZGTTIPOSLIBROS_DESCRIPCION, MZGTTIPOSLIBROS_CODIGO', 'default', 'setOnEmpty' => true, 'value' => null),
			array('PK_MZGTTIPOSLIBROS, MZGTTIPOSLIBROS_DESCRIPCION, MZGTTIPOSLIBROS_CODIGO, MZGTTIPOSLIBROS_ESTADO', 'safe', 'on'=>'search'),
		);
	}

	public function relations() {
		return array(
			'mzgtlibroses' => array(self::HAS_MANY, 'Mzgtlibros', 'FK7_MZGTLIBROS_INV_MZGTTIPOSLIBROS_PK'),
		);
	}

	public function pivotModels() {
		return array(
		);
	}

	public function attributeLabels() {
		return array(
			'PK_MZGTTIPOSLIBROS' => Yii::t('app', 'Pk Mzgttiposlibros'),
			'MZGTTIPOSLIBROS_DESCRIPCION' => Yii::t('app', 'Mzgttiposlibros Descripcion'),
			'MZGTTIPOSLIBROS_CODIGO' => Yii::t('app', 'Mzgttiposlibros Codigo'),
			'MZGTTIPOSLIBROS_ESTADO' => Yii::t('app', 'Mzgttiposlibros Estado'),
			'mzgtlibroses' => null,
		);
	}

	public function search() {
		$criteria = new CDbCriteria;

		$criteria->compare('PK_MZGTTIPOSLIBROS', $this->PK_MZGTTIPOSLIBROS);
		$criteria->compare('MZGTTIPOSLIBROS_DESCRIPCION', $this->MZGTTIPOSLIBROS_DESCRIPCION, true);
		$criteria->compare('MZGTTIPOSLIBROS_CODIGO', $this->MZGTTIPOSLIBROS_CODIGO, true);
		$criteria->compare('MZGTTIPOSLIBROS_ESTADO', $this->MZGTTIPOSLIBROS_ESTADO);

		return new CActiveDataProvider($this, array(
			'criteria' => $criteria,
		));
	}
}