always write rows even with no cells #492

This commit is contained in:
madflow authored and Adrien Loison committed 2017-11-10 11:21:57 +01:00
1 parent 8aec9ea992
commit 7367b89384
2 files changed
+10 -13

No files matched your search

+8 -11
View File
@@ -178,18 +178,15 @@ abstract class WriterAbstract implements WriterInterface
public function addRow(Row $row)
{
if ($this->isWriterOpened) {
// empty $dataRow should not add an empty line
if ($row->hasCells()) {
try {
$this->addRowToWriter($row);
} catch (SpoutException $e) {
// if an exception occurs while writing data,
// close the writer and remove all files created so far.
$this->closeAndAttemptToCleanupAllFiles();
try {
$this->addRowToWriter($row);
} catch (SpoutException $e) {
// if an exception occurs while writing data,
// close the writer and remove all files created so far.
$this->closeAndAttemptToCleanupAllFiles();
// re-throw the exception to alert developers of the error
throw $e;
}
// re-throw the exception to alert developers of the error
throw $e;
}
} else {
throw new WriterNotOpenedException('The writer needs to be opened before adding row.');