attributes() публичный Метод

The default implementation will return all column names of the table associated with this AR class.
public attributes ( ) : array
Результат array list of attribute names.
Пример #1
0
 /**
  * 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();
 }
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     if ($this->_custom_attributes) {
         return array_merge(parent::attributes(), $this->_custom_attributes);
     } else {
         return parent::attributes();
     }
 }
 public function attributes()
 {
     $class = get_class($this);
     if (!isset(self::$attributesCache[$class])) {
         self::$attributesCache[$class] = parent::attributes();
     }
     return self::$attributesCache[$class];
 }
Пример #5
0
 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
 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
 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
 /**
  * @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
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     $attributes = parent::attributes();
     $attributes[] = 'last_message_id';
     return $attributes;
 }
Пример #12
0
 public function attributes()
 {
     return parent::attributes();
     //eturn array_merge(parent::attributes(), ['publishers.name']);
 }
Пример #13
0
 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
 public function attributes()
 {
     // add related fields to searchable attributes
     return array_merge(parent::attributes(), ['searchText']);
 }
Пример #15
0
 public function attributes()
 {
     return array_merge(parent::attributes(), ['designationbien']);
 }
Пример #16
0
 public function attributes()
 {
     return array_merge(parent::attributes(), [$this->tableName() . '.users_count']);
 }
 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
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     return array_merge(parent::attributes(), ['designationbien', 'codesousfamille', 'numfacture']);
 }
Пример #20
0
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     return array_merge(parent::attributes(), ['api_name', 'type', 'api_url', 'secret_key']);
 }
Пример #21
0
 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
 public function attributes()
 {
     return array_merge(parent::attributes(), ['child']);
 }
Пример #24
0
 function attributes()
 {
     $attributes = parent::attributes();
     return array_merge($attributes, $this->dynamicAttributes);
 }
Пример #25
0
 public function attributes()
 {
     return ArrayHelper::merge(parent::attributes(), ['destinationAttribute', 'latitudeAttribute', 'longitudeAttribute', 'jsonAttribute']);
 }
Пример #26
0
 public function attributes()
 {
     return ArrayHelper::merge(ActiveRecord::attributes(), Model::attributes());
 }
Пример #27
0
 public function attributes()
 {
     return array_merge(parent::attributes(), ['situation', 'dateinventaire', 'codestructure', 'designationstructure', 'designation', 'etat', 'pourcentageecart', 'statut', 'ecartstr', 'ecarttotal']);
 }
Пример #28
0
 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;
 }