Added notifiers for ServiceGroupMembershipResolver to IcingaService & IcingaServiceGroup, created ServiceGroupMembershipResolver
This commit is contained in:
parent
c7eb34af97
commit
2efd90302c
|
@ -117,6 +117,9 @@ class IcingaService extends IcingaObject implements ExportInterface
|
|||
'apply_for'
|
||||
];
|
||||
|
||||
/** @var ServiceGroupMembershipResolver */
|
||||
protected $servicegroupMembershipResolver;
|
||||
|
||||
/**
|
||||
* @return IcingaCommand
|
||||
* @throws IcingaException
|
||||
|
@ -730,4 +733,30 @@ class IcingaService extends IcingaObject implements ExportInterface
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
protected function notifyResolvers()
|
||||
{
|
||||
$resolver = $this->getServiceGroupMembershipResolver();
|
||||
$resolver->addObject($this);
|
||||
$resolver->refreshDb();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getServiceGroupMembershipResolver()
|
||||
{
|
||||
if ($this->servicegroupMembershipResolver === null) {
|
||||
$this->servicegroupMembershipResolver = new ServiceGroupMembershipResolver(
|
||||
$this->getConnection()
|
||||
);
|
||||
}
|
||||
|
||||
return $this->servicegroupMembershipResolver;
|
||||
}
|
||||
|
||||
public function setServiceGroupMembershipResolver(ServiceGroupMembershipResolver $resolver)
|
||||
{
|
||||
$this->servicegroupMembershipResolver = $resolver;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,37 @@ class IcingaServiceGroup extends IcingaObjectGroup
|
|||
{
|
||||
protected $table = 'icinga_servicegroup';
|
||||
|
||||
/** @var ServiceGroupMembershipResolver */
|
||||
protected $servicegroupMembershipResolver;
|
||||
|
||||
public function supportsAssignments()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function getServiceGroupMembershipResolver()
|
||||
{
|
||||
if ($this->servicegroupMembershipResolver === null) {
|
||||
$this->servicegroupMembershipResolver = new ServiceGroupMembershipResolver(
|
||||
$this->getConnection()
|
||||
);
|
||||
}
|
||||
|
||||
return $this->servicegroupMembershipResolver;
|
||||
}
|
||||
|
||||
public function setServiceGroupMembershipResolver(ServiceGroupMembershipResolver $resolver)
|
||||
{
|
||||
$this->servicegroupMembershipResolver = $resolver;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function notifyResolvers()
|
||||
{
|
||||
$resolver = $this->getServiceGroupMembershipResolver();
|
||||
$resolver->addGroup($this);
|
||||
$resolver->refreshDb();
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Objects;
|
||||
|
||||
class ServiceGroupMembershipResolver extends GroupMembershipResolver
|
||||
{
|
||||
protected $type = 'service';
|
||||
}
|
Loading…
Reference in New Issue