icingaweb2-module-director/library/Director/Objects/IcingaNotification.php

64 lines
1.7 KiB
PHP

<?php
namespace Icinga\Module\Director\Objects;
class IcingaNotification extends IcingaObject
{
protected $table = 'icinga_notification';
protected $defaultProperties = array(
'id' => null,
'object_name' => null,
'object_type' => null,
'disabled' => 'n',
'host_id' => null,
'service_id' => null,
// 'users' => null,
// 'user_groups' => null,
'times_begin' => null,
'times_end' => null,
'command_id' => null,
'notification_interval' => null,
'period_id' => null,
'zone_id' => null,
);
protected $supportsCustomVars = true;
protected $supportsImports = true;
protected $supportsApplyRules = true;
protected $relatedSets = array(
'states' => 'StateFilterSet',
'types' => 'TypeFilterSet',
);
protected $relations = array(
'zone' => 'IcingaZone',
'host' => 'IcingaHost',
'service' => 'IcingaService',
'command' => 'IcingaCommand',
'period' => 'IcingaTimePeriod',
);
// listOfRelations -> users, user_groups
protected function setKey($key)
{
if (is_int($key)) {
$this->id = $key;
} elseif (is_array($key)) {
foreach (array('id', 'host_id', 'service_id', 'object_name') as $k) {
if (array_key_exists($k, $key)) {
$this->set($k, $key[$k]);
}
}
} else {
return parent::setKey($key);
}
return $this;
}
}