Commit 1a3fdbb7 authored by Simon Gadient's avatar Simon Gadient

Merge branch 'KIME-4681' into 'master'

[IMP] Ignore broken file resource on importing

refs KIME-4681

See merge request !10
parents 94b2bd13 2ac59f82
...@@ -13,6 +13,7 @@ namespace WE\SpreadsheetImport\Command; ...@@ -13,6 +13,7 @@ namespace WE\SpreadsheetImport\Command;
use TYPO3\Flow\Annotations as Flow; use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Cli\CommandController; use TYPO3\Flow\Cli\CommandController;
use TYPO3\Flow\Exception;
use WE\SpreadsheetImport\Domain\Model\SpreadsheetImport; use WE\SpreadsheetImport\Domain\Model\SpreadsheetImport;
/** /**
...@@ -63,14 +64,16 @@ class SpreadsheetImportCommandController extends CommandController { ...@@ -63,14 +64,16 @@ class SpreadsheetImportCommandController extends CommandController {
// do importing and mark its status as "Completed/Failed" // do importing and mark its status as "Completed/Failed"
$this->spreadsheetImportService->init($spreadsheetImport); $this->spreadsheetImportService->init($spreadsheetImport);
$this->spreadsheetImportService->import(); try {
$this->spreadsheetImportService->import();
// mark importing status as "Completed" $spreadsheetImport->setImportingStatus(SpreadsheetImport::IMPORTING_STATUS_COMPLETED);
$spreadsheetImport->setImportingStatus(SpreadsheetImport::IMPORTING_STATUS_COMPLETED); $this->outputFormatted('Spreadsheet has been imported. (totalInserted: %d, totalUpdated: %d, totalDeleted: %d, totalSkipped: %d)',
array($spreadsheetImport->getTotalInserted(), $spreadsheetImport->getTotalUpdated(), $spreadsheetImport->getTotalDeleted(), $spreadsheetImport->getTotalSkipped()));
} catch (Exception $e) {
$spreadsheetImport->setImportingStatus(SpreadsheetImport::IMPORTING_STATUS_FAILED);
$this->outputFormatted('Spreadsheet imported failed.');
}
$this->spreadsheetImportRepository->update($spreadsheetImport); $this->spreadsheetImportRepository->update($spreadsheetImport);
$this->outputFormatted('Spreadsheet has been imported. (totalInserted: %d, totalUpdated: %d, totalDeleted: %d, totalSkipped: %d)',
array($spreadsheetImport->getTotalInserted(), $spreadsheetImport->getTotalUpdated(), $spreadsheetImport->getTotalDeleted(), $spreadsheetImport->getTotalSkipped()));
} else { } else {
$this->outputFormatted('There is no spreadsheet importing in queue.'); $this->outputFormatted('There is no spreadsheet importing in queue.');
} }
......
...@@ -32,7 +32,7 @@ class SpreadsheetImportRepository extends Repository { ...@@ -32,7 +32,7 @@ class SpreadsheetImportRepository extends Repository {
public function findNextInQueue() { public function findNextInQueue() {
$query = $this->createQuery(); $query = $this->createQuery();
$constraint = $query->logicalAnd( $constraint = $query->logicalAnd(
$query->lessThanOrEqual('importingStatus', SpreadsheetImport::IMPORTING_STATUS_IN_QUEUE), $query->equals('importingStatus', SpreadsheetImport::IMPORTING_STATUS_IN_QUEUE),
$query->lessThanOrEqual('scheduleDate', new \DateTime()) $query->lessThanOrEqual('scheduleDate', new \DateTime())
); );
return $query->matching($constraint) return $query->matching($constraint)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment