Skip to content
Snippets Groups Projects
Commit 69ab3676 authored by Dimitris Bozelos's avatar Dimitris Bozelos
Browse files

Issue #3421720 Only read the current associated row in the loop

parent 906b3007
Branches
Tags
No related merge requests found
......@@ -156,12 +156,15 @@ class Reader implements ReaderInterface {
* The row at which to start reading.
* @param int $start_column
* The column at which to start reading.
* @param int $end_row
* The row at which to stop reading i.e. the last row to read.
*/
protected function doRead(
Worksheet $sheet,
EntityFormatInterface $format,
$start_row,
$start_column
$start_column,
$end_row = NULL
) {
$entity = NULL;
$entity_type_id = $format->getEntityTypeId();
......@@ -181,6 +184,10 @@ class Reader implements ReaderInterface {
// Go through each row and read its data.
foreach ($sheet->getRowIterator($start_row) as $row) {
if ($end_row !== NULL && $row->getRowIndex() === $end_row + 1) {
break;
}
if ($this->isRowEmpty($row)) {
continue;
}
......@@ -206,7 +213,10 @@ class Reader implements ReaderInterface {
$sheet,
$associated_format,
$row->getRowIndex(),
$associated_section['start']
$associated_section['start'],
// Only read this row, without this it would loop over all remaining
// rows and process all associated entities.
$row->getRowIndex()
);
continue;
}
......@@ -267,7 +277,10 @@ class Reader implements ReaderInterface {
$sheet,
$associated_format,
$row->getRowIndex(),
$associated_section['start']
$associated_section['start'],
// Only read this row, without this it would loop over all remaining
// rows and process all associated entities.
$row->getRowIndex()
);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment