mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
db: Add model for table dependency_state
This commit is contained in:
parent
82bbe6b50b
commit
08be2ea006
1 changed files with 58 additions and 0 deletions
58
library/Icingadb/Model/DependencyState.php
Normal file
58
library/Icingadb/Model/DependencyState.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2024 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Model;
|
||||
|
||||
use ipl\Orm\Behavior\Binary;
|
||||
use ipl\Orm\Behavior\BoolCast;
|
||||
use ipl\Orm\Behaviors;
|
||||
use ipl\Orm\Model;
|
||||
use ipl\Orm\Query;
|
||||
use ipl\Orm\Relations;
|
||||
|
||||
/**
|
||||
* Dependency state model.
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $dependency_id
|
||||
* @property bool $failed
|
||||
*
|
||||
* @property Dependency|Query $dependency
|
||||
*/
|
||||
class DependencyState extends Model
|
||||
{
|
||||
public function getTableName(): string
|
||||
{
|
||||
return 'dependency_state';
|
||||
}
|
||||
|
||||
public function getKeyName(): string
|
||||
{
|
||||
return 'id';
|
||||
}
|
||||
|
||||
public function getColumns(): array
|
||||
{
|
||||
return [
|
||||
'dependency_id',
|
||||
'failed'
|
||||
];
|
||||
}
|
||||
|
||||
public function createBehaviors(Behaviors $behaviors): void
|
||||
{
|
||||
$behaviors->add(new Binary([
|
||||
'id',
|
||||
'dependency_id'
|
||||
]));
|
||||
$behaviors->add(new BoolCast([
|
||||
'failed'
|
||||
]));
|
||||
}
|
||||
|
||||
public function createRelations(Relations $relations): void
|
||||
{
|
||||
$relations->belongsTo('dependency', Dependency::class);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue