Merge pull request #1786 from Icinga/feature/delete-service-set-children
IcingaServiceSet: Delete host sets when deleting a set
This commit is contained in:
commit
0d3649ce3f
|
@ -234,6 +234,19 @@ class IcingaServiceSet extends IcingaObject implements ExportInterface
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function beforeDelete()
|
||||||
|
{
|
||||||
|
// check if this is a template, or directly assigned to a host
|
||||||
|
if ($this->get('host_id') === null) {
|
||||||
|
// find all host sets and delete them
|
||||||
|
foreach ($this->fetchHostSets() as $set) {
|
||||||
|
$set->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::beforeDelete();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \Icinga\Exception\NotFoundError
|
* @throws \Icinga\Exception\NotFoundError
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue