mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 00:04:05 +02:00
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;
|
||||
}
|
||||
|
||||
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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user