Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#30: Extend isErrorAlreadyAdded check to also check column name so se…
…veral columns in the same row may throw the same error and they can be distinguished.
  • Loading branch information
pogster committed Jun 30, 2018
commit 0832e295c57f4140faf6101db73589f620d33896
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function addError(
$errorMessage = null,
$errorDescription = null
) {
if ($this->isErrorAlreadyAdded($rowNumber, $errorCode)) {
if ($this->isErrorAlreadyAdded($rowNumber, $errorCode, $columnName)) {
return $this;
}
$this->processErrorStatistics($errorLevel);
Expand Down Expand Up @@ -333,13 +333,14 @@ public function clear()
/**
* @param int $rowNum
* @param string $errorCode
* @param string $columnName
* @return bool
*/
protected function isErrorAlreadyAdded($rowNum, $errorCode)
protected function isErrorAlreadyAdded($rowNum, $errorCode, $columnName = null)
{
$errors = $this->getErrorsByCode([$errorCode]);
foreach ($errors as $error) {
if ($rowNum == $error->getRowNumber()) {
if ($rowNum == $error->getRowNumber() && $columnName == $error->getColumnName()) {
return true;
}
}
Expand Down