PropertyModifierHook: overridable exportSettings()

fixes #1948
This commit is contained in:
Thomas Gelf 2019-09-19 17:24:31 +02:00
parent 142e3f2c43
commit f24276ce88
3 changed files with 9 additions and 1 deletions

View File

@ -199,6 +199,11 @@ abstract class PropertyModifierHook
return $this;
}
public function exportSettings()
{
return (object) $this->settings;
}
/**
* Override this method if you want to extend the settings form
*

View File

@ -62,7 +62,7 @@ class ImportRowModifier extends DbObjectWithSettings
$properties = $this->getProperties();
unset($properties['id']);
unset($properties['source_id']);
$properties['settings'] = (object) $this->getSettings();
$properties['settings'] = $this->getInstance()->exportSettings();
ksort($properties);
return (object) $properties;

View File

@ -308,6 +308,9 @@ class ImportSource extends DbObjectWithSettings implements ExportInterface
protected function applyPropertyModifierToRow(PropertyModifierHook $modifier, $key, $row)
{
if (! is_object($row)) {
throw new InvalidArgumentException('Every imported row MUST be an object');
}
if ($modifier->requiresRow()) {
$modifier->setRow($row);
}