security->getUser(); $exportRequest->setRequesterId($access->getId()); // Prepare the file record and attach its id to the export request $exporter = $this->handler->getExporterFor($exportRequest); $file = $exporter->prepareFile($exportRequest, true); $exportRequest->setFileId($file->getId()); if (!$exportRequest->isAsync()) { $exporter->export($exportRequest); } else { // Send the export request to Messenger (@see App\Message\Handler\ExportHandler) $this->messageBus->dispatch( new Export($exportRequest) ); } return $exportRequest; } }