collection as $field) { $obj[$field->name] = $field->value; } return $obj; } }