From e82d7bcab60025f868cf5a590e4aa49e90ee3610 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 28 Nov 2019 11:23:09 +0100 Subject: [PATCH] Service: Join notes_url using id only The service join from notes_url is done with id only too. --- library/Icingadb/Model/NotesUrl.php | 4 +++- library/Icingadb/Model/Service.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/library/Icingadb/Model/NotesUrl.php b/library/Icingadb/Model/NotesUrl.php index 81c77e15..bd313a7e 100644 --- a/library/Icingadb/Model/NotesUrl.php +++ b/library/Icingadb/Model/NotesUrl.php @@ -32,6 +32,8 @@ class NotesUrl extends Model $relations->hasMany('host', Host::class) ->setCandidateKey('id') ->setForeignKey('notes_url_id'); - $relations->hasMany('service', Service::class); + $relations->hasMany('service', Service::class) + ->setCandidateKey('id') + ->setForeignKey('notes_url_id'); } } diff --git a/library/Icingadb/Model/Service.php b/library/Icingadb/Model/Service.php index f1d27adc..ece2cd13 100644 --- a/library/Icingadb/Model/Service.php +++ b/library/Icingadb/Model/Service.php @@ -92,7 +92,9 @@ class Service extends Model $relations->belongsTo('action_url', ActionUrl::class) ->setCandidateKey('action_url_id') ->setForeignKey('id'); - $relations->belongsTo('notes_url', NotesUrl::class); + $relations->belongsTo('notes_url', NotesUrl::class) + ->setCandidateKey('notes_url_id') + ->setForeignKey('id'); $relations->belongsTo('icon_image', IconImage::class); $relations->belongsTo('zone', Zone::class); $relations->belongsTo('endpoint', Endpoint::class)