本文整理汇总了PHP中Objects::getDbCriteria方法的典型用法代码示例。如果您正苦于以下问题:PHP Objects::getDbCriteria方法的具体用法?PHP Objects::getDbCriteria怎么用?PHP Objects::getDbCriteria使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Objects
的用法示例。
在下文中一共展示了Objects::getDbCriteria方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
public function actionView()
{
$model = $this->_loadModel(Yii::app()->request->getQuery('url'));
$cr = new CDbCriteria();
if ($model) {
$this->pageTitle = $model->title . ' - Быстрые отзывы покупателей';
$modelFirst = $model;
$name = $model->title;
$cr->addCondition('t.categorie=' . $model->id);
}
// $query = Objects::model()->cache(3600);
$cr->select = 't.*';
$query = new Objects(null);
$query->attachBehaviors($query->behaviors());
$query->applyAttributes($this->activeAttributes)->active();
// ->with('images');
$query->getDbCriteria()->mergeWith($cr);
$provider = new CActiveDataProvider($query, array('id' => false, 'pagination' => array('pageSize' => 25)));
$provider->sort = Objects::getCSort('t.created_date DESC, t.title');
$itemView = '_objects_view';
$count_items = $provider->totalItemCount;
$criteria = new CDbCriteria();
$criteria->scopes = 'active';
$dataProvider = new CActiveDataProvider('Objects', array('criteria' => $criteria, 'sort' => array('defaultOrder' => 't.created_date DESC'), 'pagination' => array('pageSize' => 30)));
$sql = 'select count(*) cnt, categorie
from objects
WHERE objects.status=' . Objects::STATUS_ACTIVE . '
group by categorie';
$connection = Yii::app()->db;
$command = $connection->createCommand($sql);
$rows = $command->queryAll();
$search = false;
$this->render('view', array('provider' => $provider, 'model' => $model, 'itemView' => $itemView, 'per_page' => 25, 'count_items' => $count_items, 'rows' => $rows, 'search' => $search));
}