blob: 1b3a855d38380b6a8dcdac7a5e30ea55190f55a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
<?php
/* Icinga Web 2 X.509 Module | (c) 2023 Icinga GmbH | GPLv2 */
namespace Icinga\Module\X509\Model;
use DateTime;
use ipl\Orm\Behavior\MillisecondTimestamp;
use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Query;
use ipl\Orm\Relations;
/**
* A database model for all x509 jobs
*
* @property int $id Unique identifier of this job
* @property string $name The name of this job
* @property string $author The author of this job
* @property string $cidrs The configured cidrs of this job
* @property string $ports The configured ports of this job
* @property ?string $exclude_targets The configured excluded targets of this job
* @property DateTime $ctime The creation time of this job
* @property DateTime $mtime The modification time of this job
* @property Query|X509Schedule $schedule The configured schedules of this job
* @property Query|X509JobRun $job_run Job activities
*/
class X509Job extends Model
{
public function getTableName(): string
{
return 'x509_job';
}
public function getTableAlias(): string
{
return 'job';
}
public function getKeyName()
{
return 'id';
}
public function getColumns(): array
{
return [
'name',
'author',
'cidrs',
'ports',
'exclude_targets',
'ctime',
'mtime'
];
}
public function createBehaviors(Behaviors $behaviors): void
{
$behaviors->add(new MillisecondTimestamp([
'ctime',
'mtime'
]));
}
public function createRelations(Relations $relations): void
{
$relations->hasMany('schedule', X509Schedule::class)
->setForeignKey('job_id');
$relations->hasMany('job_run', X509JobRun::class)
->setForeignKey('job_id');
}
}
|