BaseMzgtcampus.php 2.44 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
<?php

/**
 * This is the model base class for the table "mzgtcampus".
 * 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 "Mzgtcampus".
 *
 * Columns in table "mzgtcampus" available as properties of the model,
 * followed by relations of table "mzgtcampus" available as properties of the model.
 *
 * @property integer $PK_MZGTCAMPUS
 * @property string $MZGTCAMPUS_NOMBRE
 * @property string $MZGTCAMPUS_BANNER
 * @property integer $MZGTCAMPUS_ESTADO
 *
 * @property Mzgtdepartamentos[] $mzgtdepartamentoses
 */
abstract class BaseMzgtcampus extends GxActiveRecord {

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

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

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

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

	public function rules() {
		return array(
			array('MZGTCAMPUS_NOMBRE, MZGTCAMPUS_BANNER, MZGTCAMPUS_ESTADO', 'required'),
			array('MZGTCAMPUS_ESTADO', 'numerical', 'integerOnly'=>true),
			array('MZGTCAMPUS_NOMBRE', 'length', 'max'=>150),
			array('MZGTCAMPUS_BANNER', 'length', 'max'=>5),
			array('PK_MZGTCAMPUS, MZGTCAMPUS_NOMBRE, MZGTCAMPUS_BANNER, MZGTCAMPUS_ESTADO', 'safe', 'on'=>'search'),
		);
	}

	public function relations() {
		return array(
			'mzgtdepartamentoses' => array(self::MANY_MANY, 'Mzgtdepartamentos', 'mzgtcampus_departamentos(PK_MZGTCAMPUS, PK_MZGTDEPARTAMENTOS)'),
		);
	}

	public function pivotModels() {
		return array(
			'mzgtdepartamentoses' => 'MzgtcampusDepartamentos',
		);
	}

	public function attributeLabels() {
		return array(
			'PK_MZGTCAMPUS' => Yii::t('app', 'Pk Mzgtcampus'),
			'MZGTCAMPUS_NOMBRE' => Yii::t('app', 'Mzgtcampus Nombre'),
			'MZGTCAMPUS_BANNER' => Yii::t('app', 'Mzgtcampus Banner'),
			'MZGTCAMPUS_ESTADO' => Yii::t('app', 'Mzgtcampus Estado'),
			'mzgtdepartamentoses' => null,
		);
	}

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

		$criteria->compare('PK_MZGTCAMPUS', $this->PK_MZGTCAMPUS);
		$criteria->compare('MZGTCAMPUS_NOMBRE', $this->MZGTCAMPUS_NOMBRE, true);
		$criteria->compare('MZGTCAMPUS_BANNER', $this->MZGTCAMPUS_BANNER, true);
		$criteria->compare('MZGTCAMPUS_ESTADO', $this->MZGTCAMPUS_ESTADO);

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