當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Objects::attachBehaviors方法代碼示例

本文整理匯總了PHP中Objects::attachBehaviors方法的典型用法代碼示例。如果您正苦於以下問題:PHP Objects::attachBehaviors方法的具體用法?PHP Objects::attachBehaviors怎麽用?PHP Objects::attachBehaviors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Objects的用法示例。


在下文中一共展示了Objects::attachBehaviors方法的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::attachBehaviors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。