From ebe8d8daa31c145a7421c25b7ff6a3d1fe9512dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Wed, 28 Jun 2023 16:11:44 +0200 Subject: [PATCH] Fixes #3 Push empty line if no CSV question to export for a brand (cherry picked from commit bf5477d15c56e33fe980dc67cbc10a0b18f58169) --- app/Http/Controllers/QuestionController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Http/Controllers/QuestionController.php b/app/Http/Controllers/QuestionController.php index 516ac58..a55e268 100644 --- a/app/Http/Controllers/QuestionController.php +++ b/app/Http/Controllers/QuestionController.php @@ -248,6 +248,13 @@ class QuestionController extends Controller $w->insertOne([]); } + // * Push empty line if nothing to export + if (empty($results)) { + $w->insertOne([ + 'Aucune question pour cette marque' + ]); + } + /* We create a callable to output the CSV in chunk with Symfony StreamResponse you can flush the body content if necessary