Commit 0a7b07f2 authored by Simon Gadient's avatar Simon Gadient

[IMP] Specific SpreadsheetImport validation group

refs KIME-4583
parent 3b4a91db
...@@ -122,7 +122,7 @@ class FrontendMappingService { ...@@ -122,7 +122,7 @@ class FrontendMappingService {
$previewObject = $this->spreadsheetImportService->getObjectByRow($record); $previewObject = $this->spreadsheetImportService->getObjectByRow($record);
$preview = array(); $preview = array();
$hasErrors = FALSE; $hasErrors = FALSE;
$objectValidator = $this->validatorResolver->getBaseValidatorConjunction($domain); $objectValidator = $this->validatorResolver->getBaseValidatorConjunction($domain, SpreadsheetImportService::VALIDATION_GROUPS);
$errors = $objectValidator->validate($previewObject)->getFlattenedErrors(); $errors = $objectValidator->validate($previewObject)->getFlattenedErrors();
foreach ($mapping as $property => $columnMapping) { foreach ($mapping as $property => $columnMapping) {
/** @var Mapping $mapping */ /** @var Mapping $mapping */
......
...@@ -23,6 +23,8 @@ use WE\SpreadsheetImport\Domain\Model\SpreadsheetImport; ...@@ -23,6 +23,8 @@ use WE\SpreadsheetImport\Domain\Model\SpreadsheetImport;
*/ */
class SpreadsheetImportService { class SpreadsheetImportService {
const VALIDATION_GROUPS = array('Default', 'SpreadsheetImport');
/** /**
* Domain object containing the configuration the service works with * Domain object containing the configuration the service works with
* *
...@@ -204,7 +206,7 @@ class SpreadsheetImportService { ...@@ -204,7 +206,7 @@ class SpreadsheetImportService {
$totalDeleted = 0; $totalDeleted = 0;
$processedObjectIds = array(); $processedObjectIds = array();
$objectRepository = $this->getDomainRepository(); $objectRepository = $this->getDomainRepository();
$objectValidator = $this->validatorResolver->getBaseValidatorConjunction($this->domain); $objectValidator = $this->validatorResolver->getBaseValidatorConjunction($this->domain, self::VALIDATION_GROUPS);
$sheet = $this->getFileActiveSheet(); $sheet = $this->getFileActiveSheet();
$persistRecordsChunkSize = intval($this->settings['persistRecordsChunkSize']); $persistRecordsChunkSize = intval($this->settings['persistRecordsChunkSize']);
$totalCount = 0; $totalCount = 0;
......
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