diff --git a/library/Icingadb/Model/DependencyEdge.php b/library/Icingadb/Model/DependencyEdge.php index 7674ce3ed..fdf299595 100644 --- a/library/Icingadb/Model/DependencyEdge.php +++ b/library/Icingadb/Model/DependencyEdge.php @@ -62,8 +62,11 @@ public function createRelations(Relations $relations): void // "from" and "to" are only necessary for sub-query filters. $relations->belongsTo('from', DependencyNode::class) - ->setCandidateKey('from_node_id'); + ->setCandidateKey('from_node_id') + ->setJoinType('LEFT'); + $relations->belongsTo('to', DependencyNode::class) - ->setCandidateKey('to_node_id'); + ->setCandidateKey('to_node_id') + ->setJoinType('LEFT'); } } diff --git a/library/Icingadb/Model/RedundancyGroup.php b/library/Icingadb/Model/RedundancyGroup.php index d4e20140d..a2aa05030 100644 --- a/library/Icingadb/Model/RedundancyGroup.php +++ b/library/Icingadb/Model/RedundancyGroup.php @@ -21,8 +21,8 @@ * * @property (?RedundancyGroupState)|Query $state * @property Dependency|Query $dependency - * @property DependencyEdge|Query $from - * @property DependencyEdge|Query $to + * @property (?DependencyEdge)|Query $from + * @property (?DependencyEdge)|Query $to */ class RedundancyGroup extends Model { @@ -65,10 +65,13 @@ public function createRelations(Relations $relations): void $relations->belongsToMany('from', DependencyEdge::class) ->setTargetCandidateKey('from_node_id') ->setTargetForeignKey('id') - ->through(DependencyNode::class); + ->through(DependencyNode::class) + ->setJoinType('LEFT'); + $relations->belongsToMany('to', DependencyEdge::class) ->setTargetCandidateKey('to_node_id') ->setTargetForeignKey('id') - ->through(DependencyNode::class); + ->through(DependencyNode::class) + ->setJoinType('LEFT'); } }