yii\base\Arrayable::fields PHP Метод

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

A field is a named element in the returned array by Arrayable::toArray. This method should return an array of field names or field definitions. If the former, the field name will be treated as an object property name whose value will be used as the field value. If the latter, the array key should be the field name while the array value should be the corresponding field definition which can be either an object property name or a PHP callable returning the corresponding field value. The signature of the callable should be: php function ($model, $field) { return field value } For example, the following code declares four fields: - email: the field name is the same as the property name email; - firstName and lastName: the field names are firstName and lastName, and their values are obtained from the first_name and last_name properties; - fullName: the field name is fullName. Its value is obtained by concatenating first_name and last_name. php return [ 'email', 'firstName' => 'first_name', 'lastName' => 'last_name', 'fullName' => function ($model) { return $model->first_name . ' ' . $model->last_name; }, ];
См. также: toArray()
public fields ( ) : array
Результат array the list of field names or field definitions.
    public function fields();