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; }