attributes() public méthode

The default implementation will return all column names of the table associated with this AR class.
public attributes ( ) : array
Résultat array list of attribute names.
Exemple #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;
 }
 /**
  * @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];
 }
Exemple #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;
 }
Exemple #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;
 }
 /**
  * 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;
 }
Exemple #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']);
 }
Exemple #9
0
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     return array_merge(parent::attributes(), ['datefin']);
 }
 /**
  * @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;
 }
Exemple #11
0
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     $attributes = parent::attributes();
     $attributes[] = 'last_message_id';
     return $attributes;
 }
Exemple #12
0
 public function attributes()
 {
     return parent::attributes();
     //eturn array_merge(parent::attributes(), ['publishers.name']);
 }
Exemple #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']);
 }
Exemple #14
0
 public function attributes()
 {
     // add related fields to searchable attributes
     return array_merge(parent::attributes(), ['searchText']);
 }
Exemple #15
0
 public function attributes()
 {
     return array_merge(parent::attributes(), ['designationbien']);
 }
Exemple #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);
 }
 /**
  * @return array
  */
 protected function getAllowedAttributes()
 {
     return $this->_instance->attributes();
 }
Exemple #19
0
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     return array_merge(parent::attributes(), ['designationbien', 'codesousfamille', 'numfacture']);
 }
Exemple #20
0
 /**
  * @inheritdoc
  */
 public function attributes()
 {
     return array_merge(parent::attributes(), ['api_name', 'type', 'api_url', 'secret_key']);
 }
Exemple #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')];
 }
 public function attributes()
 {
     return array_merge(parent::attributes(), ['characteristics.display_type', 'characteristics.mechanism_type', 'characteristics.starp_type', 'characteristics.sex']);
 }
Exemple #23
0
 public function attributes()
 {
     return array_merge(parent::attributes(), ['child']);
 }
 function attributes()
 {
     $attributes = parent::attributes();
     return array_merge($attributes, $this->dynamicAttributes);
 }
Exemple #25
0
 public function attributes()
 {
     return ArrayHelper::merge(parent::attributes(), ['destinationAttribute', 'latitudeAttribute', 'longitudeAttribute', 'jsonAttribute']);
 }
Exemple #26
0
 public function attributes()
 {
     return ArrayHelper::merge(ActiveRecord::attributes(), Model::attributes());
 }
Exemple #27
0
 public function attributes()
 {
     return array_merge(parent::attributes(), ['situation', 'dateinventaire', 'codestructure', 'designationstructure', 'designation', 'etat', 'pourcentageecart', 'statut', 'ecartstr', 'ecarttotal']);
 }
Exemple #28
0
 public function attributes()
 {
     return array_merge(parent::attributes(), ['id', 'type', 'state', 'seller', 'username']);
 }
 /**
  * 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;
 }