Skip to content

Commit

Permalink
Fix association redefinition
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Sep 12, 2025
1 parent 5d1b04f commit 7b5b86b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/plugins/CoreServer/src/Model/Table/MatchServersTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions app/plugins/CoreServer/src/Model/Table/Oauth2ServersTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down

0 comments on commit 7b5b86b

Please sign in to comment.