當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。