From 7b5b86be791fbc6afb6de563f8febeb9061c43b5 Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Fri, 12 Sep 2025 22:21:59 +0300 Subject: [PATCH] Fix association redefinition --- .../CoreServer/src/Model/Table/MatchServersTable.php | 5 ++++- .../CoreServer/src/Model/Table/Oauth2ServersTable.php | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/plugins/CoreServer/src/Model/Table/MatchServersTable.php b/app/plugins/CoreServer/src/Model/Table/MatchServersTable.php index 6815bca8d..6708dc32c 100644 --- a/app/plugins/CoreServer/src/Model/Table/MatchServersTable.php +++ b/app/plugins/CoreServer/src/Model/Table/MatchServersTable.php @@ -59,7 +59,10 @@ public function initialize(array $config): void { $this->setTableType(\App\Lib\Enum\TableTypeEnum::Configuration); // Define associations - $this->belongsTo('Servers'); + // Avoid redefining the association if the parent already set it + if (!$this->hasAssociation('Servers')) { + $this->belongsTo('Servers'); + } $this->hasMany('CoreServer.MatchServerAttributes') ->setDependent(true) ->setCascadeCallbacks(true); diff --git a/app/plugins/CoreServer/src/Model/Table/Oauth2ServersTable.php b/app/plugins/CoreServer/src/Model/Table/Oauth2ServersTable.php index 473a73cb3..07c72bf87 100644 --- a/app/plugins/CoreServer/src/Model/Table/Oauth2ServersTable.php +++ b/app/plugins/CoreServer/src/Model/Table/Oauth2ServersTable.php @@ -54,8 +54,10 @@ public function initialize(array $config): void { $this->setTableType(\App\Lib\Enum\TableTypeEnum::Configuration); // Define associations - // XXX this is defined in HttpServersTable -// $this->belongsTo('Servers'); + // Avoid redefining the association if the parent already set it + if (!$this->hasAssociation('Servers')) { + $this->belongsTo('Servers'); + } $this->setDisplayField('hostname');