Skip to content

Commit

Permalink
Add a message if nothing has been imported
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentMarmiesse committed Sep 26, 2022
1 parent 4b15cb9 commit ebd5e0c
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Model/Import/AbstractImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,21 +412,23 @@ protected function _beforeImportData(array $dataToImport)
*/
protected function _reportResult()
{
if (count($this->messages)) {
/** @var Log $log */
$log = $this->logFactory->create();

if ($this->hasError) {
$log->setStatus(Log::STATUS_ERROR);
} else {
$log->setStatus(Log::STATUS_SUCCESS);
}
if (!count($this->messages)) {
$this->messages[] = __('Nothing to import.');
}

$log->setMessage(implode(PHP_EOL, $this->messages))
->setEntityType($this->code);
/** @var Log $log */
$log = $this->logFactory->create();

$this->logRepository->save($log);
if ($this->hasError) {
$log->setStatus(Log::STATUS_ERROR);
} else {
$log->setStatus(Log::STATUS_SUCCESS);
}

$log->setMessage(implode(PHP_EOL, $this->messages))
->setEntityType($this->code);

$this->logRepository->save($log);
}

/**
Expand Down

0 comments on commit ebd5e0c

Please sign in to comment.