mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 01:04:12 +02:00
PropertyModifierHook: provide db connection
This commit is contained in:
parent
23333f1b77
commit
66c8d7628f
@ -90,6 +90,7 @@ class ImportsourceHookTable extends QuickTable
|
||||
}
|
||||
$obj = new $mod->provider_class;
|
||||
$obj->setSettings($mod->getSettings());
|
||||
$obj->setDb($this->source->getConnection());
|
||||
$propertyModifiers[$mod->property_name][] = $obj;
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ abstract class PropertyModifierHook
|
||||
{
|
||||
protected $settings = array();
|
||||
|
||||
private $db;
|
||||
|
||||
public function getName()
|
||||
{
|
||||
$parts = explode('\\', get_class($this));
|
||||
@ -24,9 +26,9 @@ abstract class PropertyModifierHook
|
||||
return $class;
|
||||
}
|
||||
|
||||
public static function loadById($property_id, Db $db)
|
||||
public static function loadById($property_id, Db $connection)
|
||||
{
|
||||
$db = $db->getDbAdapter();
|
||||
$db = $connection->getDbAdapter();
|
||||
$modifier = $db->fetchRow(
|
||||
$db->select()->from(
|
||||
'import_row_modifier',
|
||||
@ -43,10 +45,22 @@ abstract class PropertyModifierHook
|
||||
|
||||
$obj = new $modifier->provider_class;
|
||||
$obj->setSettings($settings);
|
||||
$obj->setDb($db);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public function setDb(Db $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDb()
|
||||
{
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
public function setSettings($settings)
|
||||
{
|
||||
$this->settings = $settings;
|
||||
|
@ -232,6 +232,7 @@ class Import
|
||||
}
|
||||
$obj = new $mod->provider_class;
|
||||
$obj->setSettings($mod->getSettings());
|
||||
$obj->setDb($this->connection);
|
||||
$propertyModifiers[$mod->property_name][] = $obj;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user