Skip to content

Commit

Permalink
#-: fixed importers
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Dubrovin committed Apr 17, 2018
1 parent ae2f254 commit 22a25cb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/Exceptions/IncorrectImportFileException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Exceptions;
namespace RonasIT\Exceptions;

use Exception;

Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/IncorrectImportLineException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Exceptions;
namespace RonasIT\Exceptions;

use Exception;

Expand Down
2 changes: 1 addition & 1 deletion src/Exporters/Exporter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Support\Exporters;
namespace RonasIT\Support\Exporters;

use Maatwebsite\Excel\Facades\Excel;
use RonasIT\Support\Iterators\DBIterator;
Expand Down
8 changes: 6 additions & 2 deletions src/HelpersServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ public function boot() {
return $result[0]->count == 0;
});

app(ExcelServiceProvider::class)->boot();
app(ExcelServiceProvider::class, [
'app' => app()
])->boot();
}

public function register()
{
app(ExcelServiceProvider::class)->register();
app(ExcelServiceProvider::class, [
'app' => app()
])->register();
}
}
19 changes: 3 additions & 16 deletions src/Importers/Importer.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php

namespace App\Support\Importers;
namespace RonasIT\Support\Importers;

use App\Exceptions\IncorrectImportFileException;
use App\Exceptions\IncorrectImportLineException;
use App\Support\Exporters\LogExporter;
use RonasIT\Exceptions\IncorrectImportFileException;
use RonasIT\Exceptions\IncorrectImportLineException;
use RonasIT\Support\Iterators\CsvIterator;

class Importer
Expand Down Expand Up @@ -98,8 +97,6 @@ protected function resolve()
{
$this->createAllMarked();
$this->updateAllMarked();

$this->exportLogs();
}

protected function prepareFields($line)
Expand Down Expand Up @@ -211,16 +208,6 @@ protected function getDiff($item)
return array_diff($exportedLine, $importedLine);
}

public function exportLogs()
{
/** @var LogExporter $exporter */
$exporter = app(LogExporter::class);

$exporter->setReport($this->report);

$this->report['log_file'] = $exporter->run();
}

protected function validateHeader()
{
$line = $this->iterator->current();
Expand Down

0 comments on commit 22a25cb

Please sign in to comment.