Sync: allow to remove objects
This commit is contained in:
parent
00cb7bb9d0
commit
2164c1e2b9
|
@ -264,7 +264,7 @@ class Sync
|
|||
}
|
||||
|
||||
if (! $found) {
|
||||
// TODO: temporarily disabled, "mark" them: $object->delete();
|
||||
$object->markForRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,6 +298,11 @@ class Sync
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if ($object->shouldBeRemoved()) {
|
||||
$object->delete($db);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($object->hasBeenModified()) {
|
||||
$object->store($db);
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
|
||||
private $arguments;
|
||||
|
||||
private $shouldBeRemoved = false;
|
||||
|
||||
public function propertyIsBoolean($property)
|
||||
{
|
||||
return array_key_exists($property, $this->booleans);
|
||||
|
@ -191,6 +193,17 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
return parent::set($key, $value);
|
||||
}
|
||||
|
||||
public function markForRemoval($remove = true)
|
||||
{
|
||||
$this->shouldBeRemoved = $remove;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function shouldBeRemoved()
|
||||
{
|
||||
return $this->shouldBeRemoved;
|
||||
}
|
||||
|
||||
public function groups()
|
||||
{
|
||||
$this->assertGroupsSupport();
|
||||
|
|
Loading…
Reference in New Issue