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
|
|
|
|
2021-09-09 08:41:42 -04:00
|
|
|
use Icinga\Module\Icingadb\Model\Behavior\ActionAndNoteUrl;
|
2022-05-19 10:28:45 -04:00
|
|
|
use ipl\Orm\Behavior\Binary;
|
2021-09-09 08:41:42 -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[] $notes_url
|
|
|
|
|
* @property string $environment_id
|
|
|
|
|
*/
|
2019-09-23 09:31:18 -04:00
|
|
|
class NotesUrl extends Model
|
|
|
|
|
{
|
|
|
|
|
public function getTableName()
|
|
|
|
|
{
|
|
|
|
|
return 'notes_url';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getKeyName()
|
|
|
|
|
{
|
2022-04-08 10:13:51 -04:00
|
|
|
return 'id';
|
2019-09-23 09:31:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getColumns()
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'notes_url',
|
2019-10-02 01:51:47 -04:00
|
|
|
'environment_id'
|
2019-09-23 09:31:18 -04:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-08 09:34:01 -04:00
|
|
|
public function getColumnDefinitions()
|
2021-03-08 05:40:16 -05:00
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'notes_url' => t('Notes Url'),
|
2022-07-11 11:31:53 -04:00
|
|
|
'environment_id' => t('Environment Id')
|
2021-03-08 05:40:16 -05:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-09 08:41:42 -04:00
|
|
|
public function createBehaviors(Behaviors $behaviors)
|
|
|
|
|
{
|
|
|
|
|
$behaviors->add(new ActionAndNoteUrl(['notes_url']));
|
2022-03-29 09:27:18 -04:00
|
|
|
|
|
|
|
|
$behaviors->add(new Binary([
|
|
|
|
|
'id',
|
|
|
|
|
'environment_id'
|
|
|
|
|
]));
|
2021-09-09 08:41:42 -04:00
|
|
|
}
|
|
|
|
|
|
2019-09-23 09:31:18 -04:00
|
|
|
public function createRelations(Relations $relations)
|
|
|
|
|
{
|
|
|
|
|
$relations->belongsTo('environment', Environment::class);
|
|
|
|
|
|
2019-11-28 05:22:09 -05:00
|
|
|
$relations->hasMany('host', Host::class)
|
|
|
|
|
->setCandidateKey('id')
|
|
|
|
|
->setForeignKey('notes_url_id');
|
2019-11-28 05:23:09 -05:00
|
|
|
$relations->hasMany('service', Service::class)
|
|
|
|
|
->setCandidateKey('id')
|
|
|
|
|
->setForeignKey('notes_url_id');
|
2019-09-23 09:31:18 -04:00
|
|
|
}
|
|
|
|
|
}
|