Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\StreamedJsonResponse;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Drupal\Core\Datetime\DrupalDateTime;
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;

/**
Expand Down Expand Up @@ -98,7 +99,9 @@ protected function assertDegradedModeAllowed(object $data): void {
* Return the StreamedResponse object.
*/
protected function streamCsvResponse(DatastoreQuery $datastoreQuery, RootedJsonData $result) {
$response = $this->initStreamedCsvResponse();
$date = new DrupalDateTime();
$filename = 'data-' . $date->format('m-d-Y_g:ia', NULL) . '.csv';
$response = $this->initStreamedCsvResponse($filename);

$response->setCallback(function () use ($result, $datastoreQuery) {
// Open the stream and send the header.
Expand Down