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

        foreach ($this->data as $key => $value) {
            if ($recursive && is_array($value)) {
                $array[$key] = (new ArrayObject($value))->toArray([], [], $recursive);
            } else {
                $array[$key] = $value;
            }
        }

        return $array;
    }
public function toArray(array $fields = [], array $expand = [], $recursive = true)
    {
        $array = [];

        foreach ($this->data as $key => $value) {
            if ($recursive && is_array($value)) {
                $array[$key] = (new ArrayObject($value))->toArray([], [], $recursive);
            } else {
                $array[$key] = $value;
            }
        }

        return $array;
    }
public function toArray ( array $ fields = [ ] , array $ expand = [ ] , $ recursive = true ) { $ array = [ ] ; foreach ( $ this -> data as $ key => $ value ) { if ( $ recursive && is_array ( $ value ) ) { $ array [ $ key ] = ( new ArrayObject ( $ value ) ) -> toArray ( [ ] , [ ] , $ recursive ) ; } else { $ array [ $ key ] = $ value ; } } return $ array ; }
Converts the object into an array.

@param array   $fields    the fields that the output array should contain. Fields not specified
in [[fields()]] will be ignored. If this parameter is empty, all fields as specified
in
[[fields()]] will be returned.
@param array   $expand    the additional fields that the output array should contain.
Fields not specified in [[extraFields()]] will be ignored. If this parameter is empty,
no extra fields will be returned.
@param boolean $recursive whether to recursively return array representation of embedded objects.

@return array the array representation of the object
Converts the object into an array .