<?php

class Invitado extends CActiveRecord
{
	public $fun_rut2;
	public $fun_rut3;
	public $fun_rut4;
	public $fun_rut5;
	public $fun_rut6;
	public $fun_rut7;
	public $fun_rut8;
	public $fun_rut9;
	public $fun_rut10;
	
	public function tableName()
	{
		return 'invitado';
	}

	public function rules()
	{
		return array(
			array('inv_codigo', 'numerical', 'integerOnly'=>true),
			array('fun_rut', 'length', 'max'=>12),
			array('asis_codigo, min_codigo, fun_rut', 'safe', 'on'=>'search'),
		);
	}

	public function relations()
	{
		return array(
			'funcionario' => array(self::BELONGS_TO, 'funcionario', 'fun_rut'),
		);
	}

	public function attributeLabels()
	{
		return array(
			'inv_codigo' => 'Invitado Codigo',
			'min_codigo' => 'Minuta Asociada',
			'fun_rut' => 'Invitado',
		);
	}

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

		$criteria->compare('inv_codigo',$this->inv_codigo);
		$criteria->compare('min_codigo',$this->min_codigo);
		$criteria->compare('fun_rut',$this->fun_rut,true);

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

	public function getDbConnection()
	{
		return Yii::app()->db_minuta;
	}

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