/** * Sets an item as skipped and throws an invalid item exception. * * @param array $item * @param ConstraintViolationListInterface $violations * @param \Exception $previousException * * @throws InvalidItemException */ protected function skipItemWithConstraintViolations(array $item, ConstraintViolationListInterface $violations, \Exception $previousException = null) { if ($this->stepExecution) { $this->stepExecution->incrementSummaryInfo('skip'); } throw new InvalidItemFromViolationsException($violations, new FileInvalidItem($item, $this->stepExecution->getSummaryInfo('read_lines') + 1), [], 0, $previousException); }
/** * @param array $item * @param DataArrayConversionException $exception * * @throws InvalidItemException * @throws InvalidItemFromViolationsException */ protected function skipItemFromConversionException(array $item, DataArrayConversionException $exception) { if (null !== $this->stepExecution) { $this->stepExecution->incrementSummaryInfo('skip'); } if (null !== $exception->getViolations()) { throw new InvalidItemFromViolationsException($exception->getViolations(), new FileInvalidItem($item, $this->stepExecution->getSummaryInfo('read_lines') + 1), [], 0, $exception); } throw new InvalidItemException($exception->getMessage(), new FileInvalidItem($item, $this->stepExecution->getSummaryInfo('read_lines') + 1), [], 0, $exception); }
/** * @param int $countHeaders * @param int $countData * @param string $data * @param string $filePath * * @throws InvalidItemException */ protected function checkColumnNumber($countHeaders, $countData, $data, $filePath) { if ($countHeaders < $countData) { throw new InvalidItemException('pim_connector.steps.file_reader.invalid_item_columns_count', new FileInvalidItem($data, $this->stepExecution->getSummaryInfo('read_lines') + 1), ['%totalColumnsCount%' => $countHeaders, '%itemColumnsCount%' => $countData, '%filePath%' => $filePath, '%lineno%' => $this->fileIterator->key()]); } }