sourceItemsValidator = $sourceItemsValidator; $this->saveMultiple = $saveMultiple; $this->logger = $logger; } /** * Save Multiple Source item data * * @param SourceItemInterface[] $sourceItems * @return void * @throws InputException * @throws ValidationException * @throws CouldNotSaveException */ public function execute(array $sourceItems) { if (empty($sourceItems)) { throw new InputException(__('Input data is empty')); } $validationResult = $this->sourceItemsValidator->validate($sourceItems); if (!$validationResult->isValid()) { throw new ValidationException(__('Validation Failed'), null, 0, $validationResult); } try { $this->saveMultiple->execute($sourceItems); } catch (Exception $e) { $this->logger->error($e->getMessage()); throw new CouldNotSaveException(__('Could not save Source Item'), $e); } } }