base\ArrayableTrait toArray()

toArray() public method

Converts the model into an array.

This method will first identify which fields to be included in the resulting array by calling resolveFields(). It will then turn the model into an array with these fields. If $recursive is true, any embedded objects will also be converted into arrays.

If the model implements the yii\web\Linkable interface, the resulting array will also have a _link element which refers to a list of links as specified by the interface.

public array toArray ( array $fields = [], array $expand = [], $recursive = true )
$fields array

The fields being requested. If empty, all fields as specified by fields() will be returned.

$expand array

The additional fields being requested for exporting. Only fields declared in extraFields() will be considered.

$recursive boolean

Whether to recursively return array representation of embedded objects.

return array

The array representation of the object

doc_Yii
2016-10-30 16:50:57
Comments
Leave a Comment

Please login to continue.