attributes() public method

The default implementation will return all column names of the table associated with this AR class.
public attributes ( ) : array
return array list of attribute names.
コード例 #1
0
ファイル: Form.php プロジェクト: dawei101/yii2-admin-module
 /**
  * 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;
 }
コード例 #2
0
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     if ($this->_i18n_enabled) {
         return array_merge(parent::attributes(), $this->_getI18NAttributes());
     }
     return parent::attributes();
 }
コード例 #3
0
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     if ($this->_custom_attributes) {
         return array_merge(parent::attributes(), $this->_custom_attributes);
     } else {
         return parent::attributes();
     }
 }
コード例 #4
0
 public function attributes()
 {
     $class = get_class($this);
     if (!isset(self::$attributesCache[$class])) {
         self::$attributesCache[$class] = parent::attributes();
     }
     return self::$attributesCache[$class];
 }
コード例 #5
0
ファイル: Record.php プロジェクト: elitedivision/amos-core
 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;
 }
コード例 #6
0
ファイル: Model.php プロジェクト: jiangrongyong/docgen
 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;
 }
コード例 #7
0
 /**
  * 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;
 }
コード例 #8
0
ファイル: Reformer.php プロジェクト: ikramadjissa/Yii2Immo
 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']);
 }
コード例 #9
0
ファイル: Dat.php プロジェクト: ikramadjissa/Yii2Immo
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     return array_merge(parent::attributes(), ['datefin']);
 }
コード例 #10
0
 /**
  * @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;
 }
コード例 #11
0
ファイル: Contact.php プロジェクト: nanson/yii2-messenger
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     $attributes = parent::attributes();
     $attributes[] = 'last_message_id';
     return $attributes;
 }
コード例 #12
0
ファイル: Books.php プロジェクト: aekkapun/yii2-mylib
 public function attributes()
 {
     return parent::attributes();
     //eturn array_merge(parent::attributes(), ['publishers.name']);
 }
コード例 #13
0
ファイル: Bien.php プロジェクト: ikramadjissa/Yii2Immo
 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']);
 }
コード例 #14
0
ファイル: Request.php プロジェクト: sakqqboy/training
 public function attributes()
 {
     // add related fields to searchable attributes
     return array_merge(parent::attributes(), ['searchText']);
 }
コード例 #15
0
ファイル: Affecter.php プロジェクト: ikramadjissa/Yii2Immo
 public function attributes()
 {
     return array_merge(parent::attributes(), ['designationbien']);
 }
コード例 #16
0
ファイル: Lists.php プロジェクト: YGugnin/mailer
 public function attributes()
 {
     return array_merge(parent::attributes(), [$this->tableName() . '.users_count']);
 }
コード例 #17
0
 public function attributes()
 {
     $extraFields = $this->module !== null ? $this->module->parseExtraFields($this) : [];
     return array_merge(parent::attributes(), $extraFields);
 }
コード例 #18
0
 /**
  * @return array
  */
 protected function getAllowedAttributes()
 {
     return $this->_instance->attributes();
 }
コード例 #19
0
ファイル: Instance.php プロジェクト: ikramadjissa/Yii2Immo
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     return array_merge(parent::attributes(), ['designationbien', 'codesousfamille', 'numfacture']);
 }
コード例 #20
0
ファイル: Apply.php プロジェクト: shijl/social-open
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     return array_merge(parent::attributes(), ['api_name', 'type', 'api_url', 'secret_key']);
 }
コード例 #21
0
ファイル: Sportclub.php プロジェクト: angusty/yiidemo
 public function attributeLabels()
 {
     $parent = parent::attributes();
     return ['clubname' => Yii::t('app', 'Clubname'), 'indeximage' => Yii::t('app', 'Image'), 'manager_uid' => Yii::t('app', 'Manager Uid'), 'createtime' => Yii::t('app', 'Created At')];
 }
コード例 #22
0
 public function attributes()
 {
     return array_merge(parent::attributes(), ['characteristics.display_type', 'characteristics.mechanism_type', 'characteristics.starp_type', 'characteristics.sex']);
 }
コード例 #23
0
ファイル: AuthItem.php プロジェクト: quangnh94/myshop
 public function attributes()
 {
     return array_merge(parent::attributes(), ['child']);
 }
コード例 #24
0
 function attributes()
 {
     $attributes = parent::attributes();
     return array_merge($attributes, $this->dynamicAttributes);
 }
コード例 #25
0
ファイル: Locations.php プロジェクト: achertovsky/maplocation
 public function attributes()
 {
     return ArrayHelper::merge(parent::attributes(), ['destinationAttribute', 'latitudeAttribute', 'longitudeAttribute', 'jsonAttribute']);
 }
コード例 #26
0
ファイル: KursSearch.php プロジェクト: tsyrya/mybriop
 public function attributes()
 {
     return ArrayHelper::merge(ActiveRecord::attributes(), Model::attributes());
 }
コード例 #27
0
ファイル: Inventorier.php プロジェクト: ikramadjissa/Yii2Immo
 public function attributes()
 {
     return array_merge(parent::attributes(), ['situation', 'dateinventaire', 'codestructure', 'designationstructure', 'designation', 'etat', 'pourcentageecart', 'statut', 'ecartstr', 'ecarttotal']);
 }
コード例 #28
0
ファイル: User.php プロジェクト: hiqdev/hi3a
 public function attributes()
 {
     return array_merge(parent::attributes(), ['id', 'type', 'state', 'seller', 'username']);
 }
コード例 #29
0
 /**
  * Convert aggregate query from Kendo UI to DB aggregate functions
  *
  * @param array $aggregates usually values of $_POST['aggregates']
  * @param ActiveRecord $model model for generation aggregate functions
  * @return array aggregate functions for Query::select()
  */
 public static function aggregate($aggregates, ActiveRecord $model)
 {
     if (!$aggregates || !is_array($aggregates)) {
         return [];
     }
     $db = $model->getDb();
     $attributes = $model->attributes();
     $aggregateFunctions = static::AGGREGATE_FUNCTIONS;
     $functions = [];
     foreach ($aggregates as $aggregate) {
         if (!empty($aggregate['aggregate']) && isset($aggregateFunctions[$aggregate['aggregate']]) && !empty($aggregate['field']) && in_array($aggregate['field'], $attributes)) {
             $funcName = $aggregateFunctions[$aggregate['aggregate']];
             $functions[] = $funcName . '(' . $db->quoteColumnName($aggregate['field']) . ') ' . ' AS ' . $db->quoteColumnName($aggregate['aggregate'] . '_' . $aggregate['field']);
         }
     }
     return $functions;
 }