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');