ImportSource: provide applyModifiers helper method
This commit is contained in:
parent
29564ab742
commit
f12e4b2033
|
@ -68,12 +68,7 @@ class ImportsourceHookTable extends QuickTable
|
|||
}
|
||||
|
||||
$this->dataCache = $query->fetchAll();
|
||||
|
||||
if ($this->source->hasRowModifiers()) {
|
||||
foreach ($this->dataCache as & $row) {
|
||||
$this->source->applyModifiersToRow($row);
|
||||
}
|
||||
}
|
||||
$this->source->applyModifiers($this->dataCache);
|
||||
}
|
||||
|
||||
return $this->dataCache;
|
||||
|
|
|
@ -166,12 +166,7 @@ class Import
|
|||
)->fetchData();
|
||||
}
|
||||
|
||||
if ($this->source->hasRowModifiers()) {
|
||||
foreach ($this->data as & $row) {
|
||||
$this->source->applyModifiersToRow($row);
|
||||
}
|
||||
}
|
||||
|
||||
$this->source->applyModifiers($this->data);
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,19 @@ class ImportSource extends DbObjectWithSettings
|
|||
return null;
|
||||
}
|
||||
|
||||
public function applyModifiers(& $data)
|
||||
{
|
||||
$modifiers = $this->getRowModifiers();
|
||||
|
||||
if (! empty($modifiers)) {
|
||||
foreach ($data as &$row) {
|
||||
$this->applyModifiersToRow($row);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function applyModifiersToRow(& $row)
|
||||
{
|
||||
$modifiers = $this->getRowModifiers();
|
||||
|
|
Loading…
Reference in New Issue