Sync: also fetch columns used in filters only

Filters might otherwise in some circumstances not work as expected

fixes #876
This commit is contained in:
Thomas Gelf 2017-03-28 18:03:53 +02:00
parent e1760724b8
commit f885d90a0a
1 changed files with 15 additions and 3 deletions

View File

@ -76,6 +76,7 @@ class Sync
protected $runStartTime;
/** @var Filter[] */
protected $columnFilters = array();
/**
@ -258,9 +259,20 @@ class Sync
$key = $source->key_column;
$this->sourceColumns[$sourceId][$key] = $key;
$run = $source->fetchLastRun(true);
$rows = $run->fetchRows(
SyncUtils::getRootVariables($this->sourceColumns[$sourceId])
);
$usedColumns = SyncUtils::getRootVariables($this->sourceColumns[$sourceId]);
$filterColumns = array();
foreach ($this->columnFilters as $filter) {
foreach ($filter->listFilteredColumns() as $column) {
$filterColumns[$column] = $column;
}
}
foreach (SyncUtils::getRootVariables($filterColumns) as $column) {
$usedColumns[$column] = $column;
}
$rows = $run->fetchRows($usedColumns);
$this->imported[$sourceId] = array();
foreach ($rows as $row) {