Skip to content

Commit def67e6

Browse files
authored
Merge pull request #6 from vitorbarros/csv
Ajustando um bug da criacao do nome dos arquivos
2 parents 82f4246 + 85d0c4f commit def67e6

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/VMBDataExport/Export/CSVExport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function export()
3232
if (!is_dir($path)) {
3333
throw new \Exception("Please make sure that 'public/csv' directory exists");
3434
}
35-
$fileName = str_replace("/", ".", $this->getFilePrefix() . '_' . date("Y-m-d-H:i:s") . '.csv');
35+
$fileName = str_replace("/", ".", $this->getFilePrefix() . '_' . date("Y-m-d-H-i-s") . '.csv');
3636
$file = fopen($path . $fileName, "w");
3737

3838
fputcsv($file, $this->headers);

src/VMBDataExport/Export/Export.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Doctrine\ORM\EntityManager;
88
use Doctrine\ORM\EntityRepository;
99
use Doctrine\ORM\Mapping\Entity;
10+
use VMBDataExport\Entity\ExportableInterface;
1011
use Zend\Json\Json;
1112
use Zend\Math\Rand;
1213

@@ -89,9 +90,9 @@ private function setConfig($config) {
8990
if (!class_exists($this->entity)) {
9091
throw new \BadMethodCallException("Entity {$this->entity} does not exists");
9192
}
92-
if ($this->entity instanceof \ExportableInterface) {
93+
if ($this->entity instanceof ExportableInterface) {
9394
throw new \BadMethodCallException(
94-
"Exportable Entity {$this->entity} must implements 'VMBDataExport\\Interface\\ExportableInterface'"
95+
"Exportable Entity {$this->entity} must implements 'VMBDataExport\\Entity\\ExportableInterface'"
9596
);
9697
}
9798
$this->criteria = Json::decode($config['criteria'], Json::TYPE_ARRAY);

src/VMBDataExport/Export/XLSExport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function export()
2929
throw new \Exception("Please make sure that 'public/xls' directory exists");
3030
}
3131

32-
$fileName = str_replace("/", ".", $this->getFilePrefix() . '_' . date("Y-m-d-H:i:s") . '.xls');
32+
$fileName = str_replace("/", ".", $this->getFilePrefix() . '_' . date("Y-m-d-H-i-s") . '.xls');
3333

3434
$file = fopen($path . $fileName, "w");
3535
$count = 0;

src/VMBDataExport/Service/CustomExportService.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ public function export($query, array $headerFields, $exportClass)
5252
throw new \Exception("Class {$class} does not exist");
5353
}
5454

55+
/**
56+
* @param array $data
57+
* @param array $headerFields
58+
* @param $exportClass
59+
* @return mixed
60+
* @throws \Exception
61+
*/
5562
public function exportFromArray(array $data, array $headerFields, $exportClass)
5663
{
5764
$type = strtoupper($exportClass);

0 commit comments

Comments
 (0)