From b5c0a1052ae34d09ba508fd039d7b10cdedc5788 Mon Sep 17 00:00:00 2001 From: sanchezzzhak Date: Fri, 24 Aug 2018 16:43:09 +0300 Subject: [PATCH] hotfix add csv delimiter --- src/services/ExportService.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/services/ExportService.php b/src/services/ExportService.php index 95e7ae8..ecc1dfb 100644 --- a/src/services/ExportService.php +++ b/src/services/ExportService.php @@ -1,6 +1,7 @@ addRow($data); } $writer->close(); - \Yii::$app->end(); + exit; } /** @@ -79,11 +83,14 @@ protected function getFileName() $type = isset($types[$this->type]) ? $types[$this->type] : $this->type; return Yii::$app->controller->id . '-' . Yii::$app->controller->action->id . '-' . date('Y-m-d-Hi') . '.' . $type; } - - + protected function getWriter() { - return writer\WriterFactory::create($this->type); + $result = writer\WriterFactory::create($this->type); + if ($result instanceof CsvWriter) { + $result->setFieldDelimiter($this->csvFieldDelimiter); + } + return $result; }