diff --git a/library/Eagle/Model/Behavior/BoolCast.php b/library/Eagle/Model/Behavior/BoolCast.php new file mode 100644 index 00000000..1869300d --- /dev/null +++ b/library/Eagle/Model/Behavior/BoolCast.php @@ -0,0 +1,11 @@ +add(new BoolCast([ + 'active_checks_enabled', + 'passive_checks_enabled', + 'event_handler_enabled', + 'notifications_enabled', + 'flapping_enabled' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Eagle/Model/Service.php b/library/Eagle/Model/Service.php index 34c96140..630cf685 100644 --- a/library/Eagle/Model/Service.php +++ b/library/Eagle/Model/Service.php @@ -2,6 +2,8 @@ namespace Icinga\Module\Eagle\Model; +use Icinga\Module\Eagle\Model\Behavior\BoolCast; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -60,6 +62,17 @@ class Service extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new BoolCast([ + 'active_checks_enabled', + 'passive_checks_enabled', + 'event_handler_enabled', + 'notifications_enabled', + 'flapping_enabled' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class);