本文整理汇总了PHP中CDbCriteria::order方法的典型用法代码示例。如果您正苦于以下问题:PHP CDbCriteria::order方法的具体用法?PHP CDbCriteria::order怎么用?PHP CDbCriteria::order使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDbCriteria
的用法示例。
在下文中一共展示了CDbCriteria::order方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
/**
* Retrieves a list of models based on the current search/filter conditions.
*
* Typical usecase:
* - Initialize the model fields with values from filter form.
* - Execute this method to get CActiveDataProvider instance which will filter
* models according to data in model fields.
* - Pass data provider to CGridView, CListView or any similar widget.
*
* @return CActiveDataProvider the data provider that can return the models
* based on the search/filter conditions.
*/
public function search()
{
// @todo Please modify the following code to remove attributes that should not be searched.
$criteria = new CDbCriteria();
$criteria->compare('question_id', $this->question_id);
$criteria->compare('question_body', $this->question_body, true);
$criteria->compare('question_correct_answer_id', $this->question_correct_answer_id);
$criteria->compare('listening_id', $this->listening_id);
$criteria->order('RAND()');
return new CActiveDataProvider($this, array('criteria' => $criteria));
}
示例2: search
/**
* 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', $this->id);
$criteria->compare('nombre_comun', $this->nombre_comun, true);
$criteria->compare('nombre_cientifico', $this->nombre_cientifico, true);
$criteria->compare('nombre_ingles', $this->nombre_ingles, true);
$criteria->compare('grupo', $this->grupo, true);
$criteria->compare('familia', $this->familia, true);
$criteria->compare('lugar', $this->lugar, true);
$criteria->compare('talla_captura', $this->talla_captura, true);
$criteria->compare('aprovechamiento', $this->aprovechamiento, true);
$criteria->compare('lista_roja_iucn', $this->lista_roja_iucn, true);
$criteria->compare('veda', $this->veda, true);
$criteria->compare('arte_de_pesca', $this->arte_de_pesca, true);
$criteria->compare('tipo_arte_pesca', $this->tipo_arte_pesca, true);
$criteria->compare('generalidades', $this->generalidades, true);
$criteria->compare('distribucion', $this->distribucion, true);
$criteria->compare('foto', $this->foto, true);
$criteria->compare('html', $this->html, true);
$criteria->order('nombre_comun ASC');
return new CActiveDataProvider($this, array('criteria' => $criteria));
}