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


PHP ActiveRecord::attributes方法代碼示例

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


在下文中一共展示了ActiveRecord::attributes方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fields

 /**
  * List of model fields displayed in form
  *
  * ```php
  *  return [
  *      'id' => [
  *          'class' => Input::className(),
  *      ],
  *      'username' => [
  *          'class' => Input::className(),
  *      ],
  *      'status' => [
  *          'class' => Select::className(),
  *          'items' => [User::STATUS_ACTIVE => 'Active', User::STATUS_DELETED => 'Deleted'],
  *      ],
  *  ];
  * ```
  *
  * Default is all model attributes with class = Input
  *
  * @return array
  */
 public function fields()
 {
     $fields = [];
     foreach ($this->model->attributes() as $attribute) {
         $fields[$attribute] = ['class' => Input::className()];
     }
     return $fields;
 }
開發者ID:dawei101,項目名稱:yii2-admin-module,代碼行數:30,代碼來源:Form.php

示例2: attributes

 /**
  * @inheritdoc
  */
 public function attributes()
 {
     if ($this->_i18n_enabled) {
         return array_merge(parent::attributes(), $this->_getI18NAttributes());
     }
     return parent::attributes();
 }
開發者ID:olegantoniuk,項目名稱:components,代碼行數:10,代碼來源:BaseActiveRecord.php

示例3: attributes

 /**
  * @inheritdoc
  */
 public function attributes()
 {
     if ($this->_custom_attributes) {
         return array_merge(parent::attributes(), $this->_custom_attributes);
     } else {
         return parent::attributes();
     }
 }
開發者ID:VEKsoftware,項目名稱:yii2-report-manager,代碼行數:11,代碼來源:ClassSearch.php

示例4: attributes

 public function attributes()
 {
     $class = get_class($this);
     if (!isset(self::$attributesCache[$class])) {
         self::$attributesCache[$class] = parent::attributes();
     }
     return self::$attributesCache[$class];
 }
開發者ID:laszlovl,項目名稱:yii2-staticactiverecord,代碼行數:8,代碼來源:ActiveRecord.php

示例5: find

 public static function find()
 {
     $return = parent::find();
     if (in_array('deleted_at', parent::attributes())) {
         $tableName = static::getTableSchema()->name;
         $return->andWhere([$tableName . '.deleted_at' => null]);
     }
     return $return;
 }
開發者ID:elitedivision,項目名稱:amos-core,代碼行數:9,代碼來源:Record.php

示例6: getFields

 public function getFields()
 {
     $fields = [];
     $modelFields = count($this->activeRecord->fields()) > 0 ? $this->activeRecord->fields() : $this->activeRecord->attributes();
     foreach ($modelFields as $key => $value) {
         if (is_int($key)) {
             $fields[] = $value;
         } else {
             $fields[] = $key;
         }
     }
     return $fields;
 }
開發者ID:jiangrongyong,項目名稱:docgen,代碼行數:13,代碼來源:Model.php

示例7: loadModel

 /**
  * Populate model data
  * @param ActiveRecord $model the model to populate
  * @param array $modelData
  * @return bool true if success
  */
 public function loadModel($model, $modelData)
 {
     $model->trigger('beforeLoad');
     if (empty($modelData)) {
         return false;
     }
     $attributes = $model->attributes();
     $b = false;
     foreach ($attributes as $attrName) {
         if (array_key_exists($attrName, $modelData)) {
             $model->setAttribute($attrName, $modelData[$attrName]);
             $b = true;
         }
     }
     $model->trigger('afterLoad');
     return $b;
 }
開發者ID:fproject,項目名稱:yii2-restx,代碼行數:23,代碼來源:SaveActionTrait.php

示例8: attributes

 public function attributes()
 {
     return array_merge(parent::attributes(), ['designationbien', 'designation bien', 'anneeRef', 'date acquisition', 'actif brut', 'amortissement pratiquee', 'valeur nette', 'prix cession', 'plus value', 'moins value', 'unité', 'type reforme', 'dat ereforme']);
 }
開發者ID:ikramadjissa,項目名稱:Yii2Immo,代碼行數:4,代碼來源:Reformer.php

示例9: attributes

 /**
  * @inheritdoc
  */
 public function attributes()
 {
     return array_merge(parent::attributes(), ['datefin']);
 }
開發者ID:ikramadjissa,項目名稱:Yii2Immo,代碼行數:7,代碼來源:Dat.php

示例10: getSearchableModelAttributes

 /**
  * @param ActiveRecord $model
  * @param array $except
  * @return \im\search\components\searchable\AttributeDescriptor[]
  */
 protected function getSearchableModelAttributes($model, $except = [])
 {
     $searchableAttributes = [];
     $attributes = $model->attributes();
     $labels = $model->attributeLabels();
     foreach ($attributes as $attribute) {
         if (!in_array($attribute, $except)) {
             $searchableAttributes[] = new AttributeDescriptor(['name' => $attribute, 'label' => isset($labels[$attribute]) ? $labels[$attribute] : $model->generateAttributeLabel($attribute)]);
         }
     }
     return $searchableAttributes;
 }
開發者ID:manyoubaby123,項目名稱:imshop,代碼行數:17,代碼來源:SearchableType.php

示例11: attributes

 /**
  * @inheritdoc
  */
 public function attributes()
 {
     $attributes = parent::attributes();
     $attributes[] = 'last_message_id';
     return $attributes;
 }
開發者ID:nanson,項目名稱:yii2-messenger,代碼行數:9,代碼來源:Contact.php

示例12: attributes

 public function attributes()
 {
     return parent::attributes();
     //eturn array_merge(parent::attributes(), ['publishers.name']);
 }
開發者ID:aekkapun,項目名稱:yii2-mylib,代碼行數:5,代碼來源:Books.php

示例13: attributes

 public function attributes()
 {
     return array_merge(parent::attributes(), ['date mouvement', 'mouvement', 'affecté vers', 'transféré de', 'transféré vers', 'date fin reparation', 'type reforme', 'typereforme', 'anneeRef', 'dateRef', 'actifbrut', 'amortpratiquee', 'valeurnet', 'anneexercice', 'dotation', 'comptecomptable', 'datetrensfert', 'prixcession', 'unite', 'structure', 'compte comptable', 'designation compte', 'valeur brute', 'année exercice', 'dotation', 'amortissements cumulés', 'valeur nette', 'état', 'désignation', 'date enregistrement']);
 }
開發者ID:ikramadjissa,項目名稱:Yii2Immo,代碼行數:4,代碼來源:Bien.php

示例14: attributes

 public function attributes()
 {
     // add related fields to searchable attributes
     return array_merge(parent::attributes(), ['searchText']);
 }
開發者ID:sakqqboy,項目名稱:training,代碼行數:5,代碼來源:Request.php

示例15: attributes

 public function attributes()
 {
     return array_merge(parent::attributes(), [$this->tableName() . '.users_count']);
 }
開發者ID:YGugnin,項目名稱:mailer,代碼行數:4,代碼來源:Lists.php


注:本文中的yii\db\ActiveRecord::attributes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。