当前位置: 首页>>代码示例>>PHP>>正文


PHP Objects::behaviors方法代码示例

本文整理汇总了PHP中Objects::behaviors方法的典型用法代码示例。如果您正苦于以下问题:PHP Objects::behaviors方法的具体用法?PHP Objects::behaviors怎么用?PHP Objects::behaviors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Objects的用法示例。


在下文中一共展示了Objects::behaviors方法的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));
 }
开发者ID:Aplay,项目名称:Fastreview_site,代码行数:34,代码来源:FastreviewController.php


注:本文中的Objects::behaviors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。