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


PHP Object::find方法代码示例

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


在下文中一共展示了Object::find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: down

 public function down()
 {
     $objects = \app\models\Object::find()->asArray()->all();
     foreach ($objects as $object) {
         $this->dropColumn($object['eav_table_name'], 'property_group_id');
     }
 }
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:7,代码来源:m150320_080911_eav_property_group_id_add.php

示例2: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ObjectModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'user_name', $this->user_name])->andFilterWhere(['like', 'auth', $this->auth])->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
开发者ID:kissarat,项目名称:yii2-template,代码行数:21,代码来源:Object.php

示例3: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Object::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'id_user' => $this->id_user, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
开发者ID:rolenweb,项目名称:order283832,代码行数:21,代码来源:ObjectSearch.php

示例4: getForClass

 /**
  * @param string $class_name
  * @return null|\app\models\Object
  */
 public static function getForClass($class_name)
 {
     if (isset(static::$ids_for_class_name[$class_name])) {
         $id = static::$ids_for_class_name[$class_name];
         return Object::findById($id);
     } else {
         $object = Yii::$app->cache->get('ObjectByClassName: ' . $class_name);
         if ($object === false) {
             $object = Object::find()->where(['object_class' => $class_name])->one();
             if ($object !== null) {
                 Yii::$app->cache->set('ObjectByClassName: ' . $class_name, $object, 86400, new TagDependency(['tags' => [\devgroup\TagDependencyHelper\ActiveRecordHelper::getObjectTag($object, $object->id)]]));
             }
         }
         if (is_object($object)) {
             static::$identity_map[$object->id] = $object;
             static::$ids_for_class_name[$class_name] = $object->id;
             return static::$identity_map[$object->id];
         }
     }
     return null;
 }
开发者ID:heartshare,项目名称:dotplant2,代码行数:25,代码来源:Object.php

示例5: actionIndex

 /**
  * @return string
  */
 public function actionIndex()
 {
     $objects = new ActiveDataProvider(['query' => Object::find()->with(['lastExport', 'lastImport']), 'pagination' => ['pageSize' => 10], 'sort' => false]);
     return $this->render('index', ['objects' => $objects]);
 }
开发者ID:yii2ApplicationCollect,项目名称:dotplant2,代码行数:8,代码来源:FileController.php

示例6: actionPosts

 public function actionPosts()
 {
     if (!\Yii::$app->user->isGuest) {
         $sort = new Sort(['attributes' => ['id' => ['label' => 'ID'], 'urlimg' => ['asc' => ['urlimg' => SORT_ASC], 'desc' => ['urlimg' => SORT_DESC], 'default' => SORT_ASC, 'label' => 'Картинка'], 'id_router' => ['asc' => ['id_router' => SORT_ASC], 'desc' => ['id_router' => SORT_DESC], 'default' => SORT_ASC, 'label' => 'ID Роутора'], 'created_at' => ['label' => 'Дата создания'], 'status' => ['label' => 'Статус']]]);
         $arrayobject = array();
         $arrayrouter = array();
         if (Yii::$app->user->identity->role == 1) {
             $modelsobject = Object::find()->where(['id_user' => Yii::$app->user->identity->id])->select(['id', 'title'])->all();
             $n_object = 0;
             if ($modelsobject != NULL) {
                 foreach ($modelsobject as $modelobject) {
                     $arrayobject[$n_object] = $modelobject->id;
                     $n_object++;
                 }
             }
             $modelsrouter = Router::find()->where(['id_object' => $arrayobject])->select(['id'])->all();
             $n_router = 0;
             if ($modelsrouter != NULL) {
                 foreach ($modelsrouter as $modelrouter) {
                     $arrayrouter[$n_router] = $modelrouter->id;
                     $n_router++;
                 }
             }
             $query = Post::find()->where(['id_router' => $arrayrouter])->orderBy($sort->orders);
         }
         if (Yii::$app->user->identity->role == 5) {
             $modelsuser = Users::find()->where(['role' => 1, 'id_manager' => Yii::$app->user->identity->id])->select(['id'])->all();
             if ($modelsuser != NULL) {
                 $n_user = 0;
                 $arrayuser = array();
                 foreach ($modelsuser as $modeluser) {
                     $arrayuser[$n_user] = $modeluser->id;
                     $n_user++;
                 }
             }
             $modelsobject = Object::find()->where(['id_user' => $arrayuser])->select(['id', 'title'])->all();
             $n_object = 0;
             if ($modelsobject != NULL) {
                 foreach ($modelsobject as $modelobject) {
                     $arrayobject[$n_object] = $modelobject->id;
                     $n_object++;
                 }
             }
             $modelsrouter = Router::find()->where(['id_object' => $arrayobject])->select(['id'])->all();
             $n_router = 0;
             if ($modelsrouter != NULL) {
                 foreach ($modelsrouter as $modelrouter) {
                     $arrayrouter[$n_router] = $modelrouter->id;
                     $n_router++;
                 }
             }
             $query = Post::find()->where(['id_router' => $arrayrouter])->orderBy($sort->orders);
         }
         if (Yii::$app->user->identity->role == 10) {
             $query = Post::find()->orderBy($sort->orders);
         }
         $countQuery = clone $query;
         $pages = new Pagination(['totalCount' => $countQuery->count()]);
         $modelspost = $query->offset($pages->offset)->limit($pages->limit)->all();
         return $this->render('posts', ['modelspost' => $modelspost, 'pages' => $pages, 'sort' => $sort]);
     } else {
         return $this->redirect(['login']);
     }
 }
开发者ID:rolenweb,项目名称:order283832,代码行数:64,代码来源:SiteController.php


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