<?php
/**
* This is the model class for table "reparacao".
*
* The followings are the available columns in table 'reparacao':
* @property integer $id_recibo
* @property integer $id_ficha
* @property string $nr_serie
* @property string $nome_cliente
* @property string $marca_equipamento
* @property string $avaria
* @property string $data_recb
* @property string $data_entrega
* @property string $garantia
* @property string $preco
* @property string $observacoes
* @property string $modelo_equipamento
* @property string $telefone_cliente
* @property string $morada_cliente
* @property string $estado
*/
class Reparacao extends CActiveRecord
{
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return Reparacao the static model class
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'reparacao';
}
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('nr_serie, nome_cliente, marca_equipamento, avaria, data_recb, data_entrega, garantia, preco, observacoes, modelo_equipamento, telefone_cliente, morada_cliente, estado', 'required'),
array('id_ficha', 'numerical', 'integerOnly'=>true),
array('nr_serie, nome_cliente, avaria, garantia, preco, observacoes, modelo_equipamento, telefone_cliente, morada_cliente, estado', 'length', 'max'=>255),
array('marca_equipamento', 'length', 'max'=>10),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id_recibo, id_ficha, nr_serie, nome_cliente, marca_equipamento, avaria, data_recb, data_entrega, garantia, preco, observacoes, modelo_equipamento, telefone_cliente, morada_cliente, estado', 'safe', 'on'=>'search'),
);
}
/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'id_recibo' => 'Id Reparacao',
'id_ficha' => 'Id Ficha',
'nr_serie' => 'Nr Serie',
'nome_cliente' => 'Nome Cliente',
'marca_equipamento' => 'Marca Equipamento',
'avaria' => 'Avaria',
'data_recb' => 'Data Recb',
'data_entrega' => 'Data Entrega',
'garantia' => 'Garantia',
'preco' => 'Preco',
'observacoes' => 'Observacoes',
'modelo_equipamento' => 'Modelo Equipamento',
'telefone_cliente' => 'Telefone Cliente',
'morada_cliente' => 'Morada Cliente',
'estado' => 'Estado',
);
}
/**
* Retrieves a list of models based on the current search/filter conditions.
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
*/
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('id_recibo',$this->id_recibo);
$criteria->compare('id_ficha',$this->id_ficha);
$criteria->compare('nr_serie',$this->nr_serie,true);
$criteria->compare('nome_cliente',$this->nome_cliente,true);
$criteria->compare('marca_equipamento',$this->marca_equipamento,true);
$criteria->compare('avaria',$this->avaria,true);
$criteria->compare('data_recb',$this->data_recb,true);
$criteria->compare('data_entrega',$this->data_entrega,true);
$criteria->compare('garantia',$this->garantia,true);
$criteria->compare('preco',$this->preco,true);
$criteria->compare('observacoes',$this->observacoes,true);
$criteria->compare('modelo_equipamento',$this->modelo_equipamento,true);
$criteria->compare('telefone_cliente',$this->telefone_cliente,true);
$criteria->compare('morada_cliente',$this->morada_cliente,true);
$criteria->compare('estado',$this->estado,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
}