If some of the attributes in your Form are not in the database, and your Mode integrates ActiveRecord, you can rewrite those attributes that are not defined in the database through $model->load(). attributes() function, for example:
/** * * {@inheritDoc} * * @see \common\db\ActiveRecord::attributes() */ public function attributes () { $attributes = parent::attributes(); $attributes[] = 'sync_take_rate'; $attributes[] = 'sync_show_virtual'; return $attributes; }
Then setting labels and hints in attributeLabels() and attributeHints() is the same as writing other attributes.
The above introduces Yii2 ActiveRecord to add additional attributes, including aspects. I hope it will be helpful to friends who are interested in PHP tutorials.