Commit 21871ea8 authored by jaapjansma's avatar jaapjansma
Browse files

check for no results

parent ba804b90
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
namespace Civi\DataProcessorTokenOutput\Output; namespace Civi\DataProcessorTokenOutput\Output;
use Civi\DataProcessor\DataFlow\EndOfFlowException;
use Civi\DataProcessor\DataFlow\Sort\SortCompareFactory; use Civi\DataProcessor\DataFlow\Sort\SortCompareFactory;
use Civi\DataProcessor\DataFlow\SqlDataFlow; use Civi\DataProcessor\DataFlow\SqlDataFlow;
use Civi\DataProcessor\Exception\DataSourceNotFoundException; use Civi\DataProcessor\Exception\DataSourceNotFoundException;
...@@ -181,7 +182,11 @@ class Token implements OutputInterface { ...@@ -181,7 +182,11 @@ class Token implements OutputInterface {
} }
$this->initializeDataProcessorClass($contact_id, $dataProcessorClass, $configuration); $this->initializeDataProcessorClass($contact_id, $dataProcessorClass, $configuration);
$record = $dataProcessorClass->getDataFlow()->nextRecord(); try {
$record = $dataProcessorClass->getDataFlow()->nextRecord();
} catch (EndOfFlowException $e) {
return; // Do nothing there is no data.
}
foreach($availableFields as $outputFieldHandler) { foreach($availableFields as $outputFieldHandler) {
$field = $outputFieldHandler->getOutputFieldSpecification(); $field = $outputFieldHandler->getOutputFieldSpecification();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment