IcingaObject: add/fix customvar support

This commit is contained in:
Thomas Gelf 2015-06-24 10:13:06 +02:00
parent 9504f9a094
commit 1bdeff3474
1 changed files with 20 additions and 0 deletions

View File

@ -35,6 +35,15 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
return $this->supportsGroups;
}
public function hasBeenModified()
{
if ($this->supportsCustomVars() && $this->vars !== null && $this->vars()->hasBeenModified()) {
return true;
}
return parent::hasBeenModified();
}
public function groups()
{
$this->assertGroupsSupport();
@ -117,14 +126,25 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
public function onInsert()
{
$this->storeCustomVars();
DirectorActivityLog::logCreation($this, $this->connection);
}
public function onUpdate()
{
$this->storeCustomVars();
DirectorActivityLog::logModification($this, $this->connection);
}
protected function storeCustomVars()
{
if ($this->supportsCustomVars()) {
$this->vars()->storeToDb($this);
}
return $this;
}
public function onDelete()
{
DirectorActivityLog::logRemoval($this, $this->connection);