CustomVariables: allow to instantiate from cache
This commit is contained in:
parent
b09c4f8ef0
commit
f288ddaf95
|
@ -133,6 +133,18 @@ class CustomVariables implements Iterator, Countable, IcingaConfigRenderer
|
||||||
return $vars;
|
return $vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function forStoredRows($rows)
|
||||||
|
{
|
||||||
|
$vars = new CustomVariables;
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$vars->vars[$row->varname] = CustomVariable::fromDbRow($row);
|
||||||
|
}
|
||||||
|
$vars->refreshIndex();
|
||||||
|
$vars->setUnmodified();
|
||||||
|
|
||||||
|
return $vars;
|
||||||
|
}
|
||||||
|
|
||||||
public function storeToDb(IcingaObject $object)
|
public function storeToDb(IcingaObject $object)
|
||||||
{
|
{
|
||||||
$db = $object->getDb();
|
$db = $object->getDb();
|
||||||
|
|
Loading…
Reference in New Issue