<?php

/**
 * This is the model base class for the table "senhas".
 * 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 "Senhas".
 *
 * Columns in table "senhas" available as properties of the model,
 * and there are no model relations.
 *
 * @property integer $PWD_IDSENHA
 * @property string $PWD_DATA
 * @property integer $PWD_IDFUNCIONARIO
 * @property string $PWD_SENHA
 *
 */
class Senhas extends GxActiveRecord {

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

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

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

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

    public function behaviors() {
        return array('datetimeI18NBehavior' => array('class' => 'ext.DateTimeI18NBehavior'));
    }

    public function rules() {
        return array(
            array('PWD_DATA, PWD_IDFUNCIONARIO, PWD_SENHA', 'required'),
            array('PWD_IDFUNCIONARIO', 'numerical', 'integerOnly' => true),
            array('PWD_SENHA', 'length', 'max' => 50),
            array('PWD_IDSENHA, PWD_DATA, PWD_IDFUNCIONARIO, PWD_SENHA', 'safe', 'on' => 'search'),
        );
    }

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

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

    public function attributeLabels() {
        return array(
            'PWD_IDSENHA'       => 'Código',
            'PWD_DATA'          => 'Data',
            'PWD_IDFUNCIONARIO' => 'Funcionário',
            'PWD_SENHA'         => 'Senha',
        );
    }

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

        $criteria->compare('PWD_IDSENHA', $this->PWD_IDSENHA);
        $criteria->compare('PWD_DATA', $this->PWD_DATA, true);
        $criteria->compare('PWD_IDFUNCIONARIO', $this->PWD_IDFUNCIONARIO);
        $criteria->compare('PWD_SENHA', $this->PWD_SENHA, true);

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

}