Source

cruge / models / data / CrugeFieldValue.php

<?php
/** CrugeFieldValue
 * This is the model class for table "cruge_fieldvalue".
 *
 * The followings are the available columns in table 'cruge_fieldvalue':
 * @property integer $idfieldvalue
 * @property integer $iduser
 * @property integer $idfield
 * @property string $value
 * @author: Christian Salazar H. <christiansalazarh@gmail.com> @bluyell
 * @license protected/modules/cruge/LICENCE
 */
class CrugeFieldValue extends CActiveRecord
{
	/*
		devuelve un objeto que implementa a ICrugeFieldValue
	*/
	public static function loadModel($id){
		return self::model()->findByPk($id);
	}
	public static function loadModelBy($iduser,$idfield){
		return self::model()->findByAttributes(array('iduser'=>$iduser,'idfield'=>$idfield));
	}
	
	/**
		devuelve un array de objetos que implementan a ICrugeFieldValue
	*/
	public static function listModels($iduser){
		return self::model()->findAllByAttributes(array('iduser'=>$iduser));
	}
	
	
	/**
		retorna el nombre de la tabla
	*/
	public function tableName(){
		return CrugeUtil::getTableName("fieldvalue");
	}

	/*
		devuelve "el valor" del indice primario
	*/
	public function getPrimaryKey(){
		return $this->idfieldvalue;
	}
	


	/**
	 * Returns the static model of the specified AR class.
	 * @return CrugeFieldValue the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @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('iduser, idfield', 'required'),
			array('iduser, idfield', 'numerical', 'integerOnly'=>true),
			array('value', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('idfieldvalue, iduser, idfield, value', '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(
			'idfieldvalue' => 'Idfieldvalue',
			'iduser' => 'Iduser',
			'idfield' => 'Idfield',
			'value' => 'Value',
		);
	}

	/**
	 * 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('idfieldvalue',$this->idfieldvalue);
		$criteria->compare('iduser',$this->iduser);
		$criteria->compare('idfield',$this->idfield);
		$criteria->compare('value',$this->value,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.