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


PHP ActiveRecord::fields方法代码示例

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


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

示例1: fields

 /**
  * @inheritdoc
  */
 public function fields()
 {
     $fields = parent::fields();
     $fields['class_trainer_name'] = function () {
         $trainer = $this->getTrainer()->toArray();
         return $trainer['user_type'] === "studio" ? $trainer['payment']['payment_bussines_name'] : $trainer['payment']['payment_first_name'] . " " . $trainer['payment']['payment_last_name'];
     };
     $fields['stream'] = function () {
         return $this->getStream();
     };
     $fields['pay_sum'] = function () {
         return (int) $this->getSumPay();
     };
     $fields['pay_count'] = function () {
         return (int) $this->getStudentCount();
     };
     $fields['activity_name'] = function () {
         return $this->getActivity();
     };
     $fields['studio_trainer'] = function () {
         return $this->getStudioTrainer();
     };
     if (Yii::$app->request->get('booking')) {
         $fields['students'] = function () {
             return $this->getStudentList();
         };
     }
     return $fields;
 }
开发者ID:pylypen,项目名称:api-side,代码行数:32,代码来源:Classes.php

示例2: fields

 public function fields()
 {
     $fields = parent::fields();
     $fields['title'] = 'titleLang';
     $fields['description'] = 'description';
     return $fields;
 }
开发者ID:heartshare,项目名称:yii2-translated-behavior,代码行数:7,代码来源:Post.php

示例3: fields

 /**
  * 过滤最终返回的字段
  * 
  * @author NJ 2016年8月1日15:21:44
  * @return array 字段
  * 
  */
 public function fields()
 {
     # code...
     $fields = parent::fields();
     unset($fields['code']);
     return $fields;
 }
开发者ID:NingerJohn,项目名称:vfinder.cn-ya,代码行数:14,代码来源:Country.php

示例4: fields

 public function fields()
 {
     $fields = parent::fields();
     // remove fields that contain sensitive information
     unset($fields['auth_key'], $fields['password_hash'], $fields['password_reset_token']);
     return $fields;
 }
开发者ID:rocketyang,项目名称:admap,代码行数:7,代码来源:User.php

示例5: fields

 public function fields()
 {
     $fields = parent::fields();
     $fields[] = 'artist';
     $fields[] = 'singleStyles';
     return $fields;
 }
开发者ID:YGugnin,项目名称:Elb-v3,代码行数:7,代码来源:Single.php

示例6: fields

 public function fields()
 {
     $fields = parent::fields();
     error_log(print_r($fields, 1));
     unset($fields['password']);
     return $fields;
 }
开发者ID:lipengyihao,项目名称:yii2-basic-advanced,代码行数:7,代码来源:Users.php

示例7: fields

 public function fields()
 {
     $fields = parent::fields();
     $fields['bookings_count'] = function () {
         return (int) $this->getBookingsCount();
     };
     return $fields;
 }
开发者ID:pylypen,项目名称:admin-side,代码行数:8,代码来源:Actives.php

示例8: fields

 public function fields()
 {
     $fields = parent::fields();
     $fields['cover'] = function ($model) {
         return file_exists($model->getCoverPath()) ? $model->getCoverPath() : '';
     };
     return $fields;
 }
开发者ID:cutcut,项目名称:orbitsoft,代码行数:8,代码来源:Books.php

示例9: fields

 /**
  * @inheritdoc
  */
 public function fields()
 {
     $fields = parent::fields();
     unset($fields['auth_key']);
     unset($fields['password_hash']);
     unset($fields['password_reset_token']);
     return $fields;
 }
开发者ID:artpro676,项目名称:twitter,代码行数:11,代码来源:User.php

示例10: fields

 public function fields()
 {
     $fields = parent::fields();
     /* $fields['code'] = function ($model) {
            return (new District())->getCodeById($model->district_id);
        }; */
     //unset($fields['created_by'],$fields['updated_by'],$fields['created_at'],$fields['updated_at']);
     return $fields;
 }
开发者ID:judy123,项目名称:yii2_advanced,代码行数:9,代码来源:Classify.php

示例11: fields

 /**
  * @inheritdoc
  */
 public function fields()
 {
     $fields = parent::fields();
     unset($fields['tree'], $fields['lft'], $fields['rgt'], $fields['depth']);
     $fields['hasChildren'] = function ($model) {
         /** @var Tree $model */
         return $model->children(1)->count() > 0;
     };
     return $fields;
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:13,代码来源:Tree.php

示例12: fields

 public function fields()
 {
     $fields = parent::fields();
     unset($fields['mem']);
     return array_merge($fields, ['data', 'date' => function () {
         return Time::dateNormalize($this->created);
     }, 'model' => function () {
         return $this->getData()->getModel();
     }]);
     // TODO: Change the autogenerated stub
 }
开发者ID:KPEMATOP,项目名称:findspree_old,代码行数:11,代码来源:Wall.php

示例13: fields

 /**
  * @inheritdoc
  */
 public function fields()
 {
     $fields = parent::fields();
     $fields['sender'] = function () {
         return $this->getSender();
     };
     $fields['receiver'] = function () {
         return $this->getReceiver();
     };
     return $fields;
 }
开发者ID:pylypen,项目名称:api-side,代码行数:14,代码来源:Chat.php

示例14: fields

 public function fields()
 {
     $fields = parent::fields();
     $fields['password'] = function () {
         return '******';
     };
     $fields['roles'] = function () {
         return \yii\helpers\ArrayHelper::getColumn(Yii::$app->authManager->getRolesByUser($this->id), 'name');
     };
     unset($fields['auth_key'], $fields['access_token']);
     return $fields;
 }
开发者ID:bzboy,项目名称:LyHNIMS,代码行数:12,代码来源:UserForm.php

示例15: fields

 /**
  * @inheritdoc
  */
 public function fields()
 {
     $result = parent::fields();
     unset($result['auth_key']);
     unset($result['fb_uid']);
     unset($result['role']);
     unset($result['status']);
     if (isset($result['gender'])) {
         $result['gender'] = 'genderName';
     }
     return $result;
 }
开发者ID:bolom009,项目名称:testwork_api,代码行数:15,代码来源:User.php


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