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
|
|
|
|
|
|
|
|
use ipl\Orm\Model;
|
|
|
|
|
use ipl\Orm\Relations;
|
|
|
|
|
|
|
|
|
|
class Checkcommand extends Model
|
|
|
|
|
{
|
|
|
|
|
public function getTableName()
|
|
|
|
|
{
|
|
|
|
|
return 'checkcommand';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getKeyName()
|
|
|
|
|
{
|
|
|
|
|
return 'id';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getColumns()
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'zone_id',
|
|
|
|
|
'environment_id',
|
|
|
|
|
'name_checksum',
|
|
|
|
|
'properties_checksum',
|
|
|
|
|
'name',
|
|
|
|
|
'name_ci',
|
|
|
|
|
'command',
|
|
|
|
|
'timeout'
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createRelations(Relations $relations)
|
|
|
|
|
{
|
|
|
|
|
$relations->belongsTo('environment', Environment::class);
|
|
|
|
|
$relations->belongsTo('zone', Zone::class);
|
|
|
|
|
|
|
|
|
|
$relations->belongsToMany('customvar', Customvar::class)
|
2019-11-19 08:22:17 -05:00
|
|
|
->through(CheckcommandCustomvar::class);
|
2019-09-23 09:31:18 -04:00
|
|
|
$relations->belongsToMany('customvar_flat', CustomvarFlat::class)
|
2019-11-19 08:22:17 -05:00
|
|
|
->through(CheckcommandCustomvar::class);
|
2019-09-23 09:31:18 -04:00
|
|
|
|
|
|
|
|
$relations->hasMany('argument', CheckcommandArgument::class)
|
|
|
|
|
->setForeignKey('command_id');
|
|
|
|
|
$relations->hasMany('envvar', CheckcommandEnvvar::class)
|
|
|
|
|
->setForeignKey('command_id');
|
|
|
|
|
$relations->hasMany('host', Host::class);
|
|
|
|
|
$relations->hasMany('service', Service::class);
|
|
|
|
|
}
|
|
|
|
|
}
|