blob: 476641aa01dc092ea9134369bd9e7693d7d67ae2 (
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
|
<?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\Relations;
/**
* A database model for all x509 job schedules
*
* @property int $id Unique identifier of this job
* @property int $job_id The id of the x509 job this schedule belongs to
* @property string $name The name of this job schedule
* @property string $author The author of this job schedule
* @property string $config The config of this job schedule
* @property DateTime $ctime The creation time of this job
* @property DateTime $mtime The modification time of this job
* @property X509Job $job The x509 job this schedule belongs to
* @property X509JobRun $job_run Schedule activities
*/
class X509Schedule extends Model
{
public function getTableName(): string
{
return 'x509_schedule';
}
public function getTableAlias(): string
{
return 'schedule';
}
public function getKeyName()
{
return 'id';
}
public function getColumns(): array
{
return [
'job_id',
'name',
'author',
'config',
'ctime',
'mtime'
];
}
public function createBehaviors(Behaviors $behaviors): void
{
$behaviors->add(new MillisecondTimestamp([
'ctime',
'mtime'
]));
}
public function createRelations(Relations $relations): void
{
$relations->belongsTo('job', X509Job::class)
->setCandidateKey('job_id');
$relations->hasMany('job_run', X509JobRun::class)
->setForeignKey('schedule_id');
}
}
|