@@ -26,6 +26,11 @@ class ProcessingErrorAggregator implements ProcessingErrorAggregatorInterface
2626 */
2727 protected $ items = [];
2828
29+ /**
30+ * @var ProcessingError[]
31+ */
32+ private $ itemsByRowColumnAndCode = [];
33+
2934 /**
3035 * @var int[]
3136 */
@@ -87,13 +92,13 @@ public function addError(
8792 $ this ->processInvalidRow ($ rowNumber );
8893 }
8994 $ errorMessage = $ this ->getErrorMessage ($ errorCode , $ errorMessage , $ columnName );
90-
9195 /** @var ProcessingError $newError */
9296 $ newError = $ this ->errorFactory ->create ();
9397 $ newError ->init ($ errorCode , $ errorLevel , $ rowNumber , $ columnName , $ errorMessage , $ errorDescription );
9498 $ this ->items ['rows ' ][$ rowNumber ][] = $ newError ;
9599 $ this ->items ['codes ' ][$ errorCode ][] = $ newError ;
96100 $ this ->items ['messages ' ][$ errorMessage ][] = $ newError ;
101+ $ this ->itemsByRowColumnAndCode [$ rowNumber ][$ columnName ][$ errorCode ] = $ newError ;
97102 return $ this ;
98103 }
99104
@@ -356,7 +361,7 @@ public function clear()
356361 $ this ->errorStatistics = [];
357362 $ this ->invalidRows = [];
358363 $ this ->skippedRows = [];
359-
364+ $ this -> itemsByRowColumnAndCode = [];
360365 return $ this ;
361366 }
362367
@@ -370,13 +375,7 @@ public function clear()
370375 */
371376 protected function isErrorAlreadyAdded ($ rowNum , $ errorCode , $ columnName = null )
372377 {
373- $ errors = $ this ->getErrorsByCode ([$ errorCode ]);
374- foreach ($ errors as $ error ) {
375- if ($ rowNum == $ error ->getRowNumber () && $ columnName == $ error ->getColumnName ()) {
376- return true ;
377- }
378- }
379- return false ;
378+ return isset ($ this ->itemsByRowColumnAndCode [$ rowNum ][$ columnName ][$ errorCode ]);
380379 }
381380
382381 /**
0 commit comments