-1
$this->hasOne('Users');
 
$this->belongsToMany('Users', [
     'through' => 'Memberships'
]);
$this->hasMany('Memberships', [
     'foreignKey' => 'profile_id',
]);
ndm
  • 59,784
  • 9
  • 71
  • 110
aaaa
  • 73
  • 1
  • 6

1 Answers1

0

By using a different alias for one of the associations, they must be unique as they are stored in one and the same collection/registry.

$this->hasOne('PrimaryUsers', [
    'className' => 'Users',
]);

See also

ndm
  • 59,784
  • 9
  • 71
  • 110