2019-09-23 09:31:18 -04:00
|
|
|
<?php
|
|
|
|
|
|
2020-03-13 03:38:01 -04:00
|
|
|
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
|
|
|
|
|
2019-11-04 19:07:30 -05:00
|
|
|
namespace Icinga\Module\Icingadb\Model;
|
2019-09-23 09:31:18 -04:00
|
|
|
|
2022-05-19 10:28:45 -04:00
|
|
|
use ipl\Orm\Behavior\Binary;
|
2022-03-29 09:27:18 -04:00
|
|
|
use ipl\Orm\Behaviors;
|
2019-09-23 09:31:18 -04:00
|
|
|
use ipl\Orm\Model;
|
|
|
|
|
use ipl\Orm\Relations;
|
|
|
|
|
|
2024-01-23 02:43:02 -05:00
|
|
|
/**
|
|
|
|
|
* @property string $id
|
|
|
|
|
* @property string $environment_id
|
|
|
|
|
* @property string $name_checksum
|
|
|
|
|
* @property string $name
|
|
|
|
|
* @property string $value
|
|
|
|
|
*/
|
2019-09-23 09:31:18 -04:00
|
|
|
class Customvar extends Model
|
|
|
|
|
{
|
|
|
|
|
public function getTableName()
|
|
|
|
|
{
|
|
|
|
|
return 'customvar';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getKeyName()
|
|
|
|
|
{
|
|
|
|
|
return 'id';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getColumns()
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'environment_id',
|
|
|
|
|
'name_checksum',
|
|
|
|
|
'name',
|
|
|
|
|
'value'
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-29 09:27:18 -04:00
|
|
|
public function createBehaviors(Behaviors $behaviors)
|
|
|
|
|
{
|
|
|
|
|
$behaviors->add(new Binary([
|
|
|
|
|
'id',
|
|
|
|
|
'environment_id',
|
|
|
|
|
'name_checksum'
|
|
|
|
|
]));
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-23 09:31:18 -04:00
|
|
|
public function createRelations(Relations $relations)
|
|
|
|
|
{
|
|
|
|
|
$relations->belongsTo('environment', Environment::class);
|
|
|
|
|
|
|
|
|
|
$relations->belongsToMany('checkcommand', Checkcommand::class)
|
2019-11-19 08:22:17 -05:00
|
|
|
->through(CheckcommandCustomvar::class);
|
2019-09-23 09:31:18 -04:00
|
|
|
$relations->belongsToMany('eventcommand', Eventcommand::class)
|
2019-11-19 08:22:17 -05:00
|
|
|
->through(EventcommandCustomvar::class);
|
2019-09-23 09:31:18 -04:00
|
|
|
$relations->belongsToMany('host', Host::class)
|
2019-11-19 08:22:17 -05:00
|
|
|
->through(HostCustomvar::class);
|
2019-09-23 09:31:18 -04:00
|
|
|
$relations->belongsToMany('hostgroup', Hostgroup::class)
|
2019-11-19 08:22:17 -05:00
|
|
|
->through(HostgroupCustomvar::class);
|
2019-09-23 09:31:18 -04:00
|
|
|
$relations->belongsToMany('notification', Notification::class)
|
2019-11-19 08:22:17 -05:00
|
|
|
->through(NotificationCustomvar::class);
|
2019-09-23 09:31:18 -04:00
|
|
|
$relations->belongsToMany('notificationcommand', Notificationcommand::class)
|
2019-11-19 08:22:17 -05:00
|
|
|
->through(NotificationcommandCustomvar::class);
|
2019-09-23 09:31:18 -04:00
|
|
|
$relations->belongsToMany('service', Service::class)
|
2019-11-19 08:22:17 -05:00
|
|
|
->through(ServiceCustomvar::class);
|
2019-09-23 09:31:18 -04:00
|
|
|
$relations->belongsToMany('servicegroup', Servicegroup::class)
|
2019-11-19 08:22:17 -05:00
|
|
|
->through(ServicegroupCustomvar::class);
|
2019-09-23 09:31:18 -04:00
|
|
|
$relations->belongsToMany('timeperiod', Timeperiod::class)
|
2019-11-19 08:22:17 -05:00
|
|
|
->through(TimeperiodCustomvar::class);
|
2019-09-23 09:31:18 -04:00
|
|
|
$relations->belongsToMany('user', User::class)
|
2019-11-19 08:22:17 -05:00
|
|
|
->through(UserCustomvar::class);
|
2019-09-23 09:31:18 -04:00
|
|
|
$relations->belongsToMany('usergroup', Usergroup::class)
|
2019-11-19 08:22:17 -05:00
|
|
|
->through(UsergroupCustomvar::class);
|
2019-09-23 09:31:18 -04:00
|
|
|
|
|
|
|
|
$relations->hasMany('customvar_flat', CustomvarFlat::class);
|
|
|
|
|
}
|
|
|
|
|
}
|