: This article describes how to add additional attributes to Yii2ActiveRecord. For more information about PHP tutorials, see. If some of the attributes in your Form are not in the database, and your Mode integrates ActiveRecord, you want to use $ model-> load () you can rewrite the attributes () function to load attributes not defined in the database. 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, in attributeLabels () and attributeHints (), it is the same as writing other attributes to set label and hint.
The preceding section describes how to add additional attributes to Yii2 ActiveRecord, including related content. I hope to help some friends who are interested in PHP tutorials.