<?php

/**
 * This is the model base class for the table "observacoes".
 * 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 "Observacoes".
 *
 * Columns in table "observacoes" available as properties of the model,
 * and there are no model relations.
 *
 * @property integer $OBS_IDOBSERVACAO
 * @property string $OBS_ASSUNTO
 * @property string $OBS_DESCRICAO
 * @property integer $OBS_STATUS
 *
 */
class Observacoes extends GxActiveRecord {

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

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

    public static function label($n = 1) {
        return Yii::t('app', 'Observação|Observações', $n);
    }

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

    public function rules() {
        return array(
            array('OBS_ASSUNTO, OBS_DESCRICAO, OBS_STATUS', 'required'),
            array('OBS_ASSUNTO', 'length', 'max' => 255),
            array('OBS_IDOBSERVACAO, OBS_ASSUNTO, OBS_DESCRICAO, OBS_STATUS', 'safe', 'on' => 'search'),
        );
    }

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

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

    public function attributeLabels() {
        return array(
            'OBS_IDOBSERVACAO'  => 'Código',
            'OBS_ASSUNTO'       => 'Assunto',
            'OBS_DESCRICAO'     => 'Descrição',
            'OBS_STATUS'        => 'Status',
        );
    }

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

        $criteria->compare('OBS_IDOBSERVACAO', $this->OBS_IDOBSERVACAO);
        $criteria->compare('OBS_ASSUNTO', $this->OBS_ASSUNTO, true);
        $criteria->compare('OBS_DESCRICAO', $this->OBS_DESCRICAO, true);
        $criteria->compare('OBS_STATUS', $this->OBS_STATUS);

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

}