-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
I created a user model(inherited from User) , the user may have many friends , I managed this by using hasMany through relation and friend model for keep the relations. but when I fetch user friends , it returns the user itself , the forked repo , I created the relations as below :
//user relations
"relations": {
"friends": {
"type": "hasMany",
"model": "user",
"foreignKey": "userId",
"through": "friend",
"keyThrough": "friendId"
}
}
//friend relations
"relations": {
"firend": {
"type": "belongsTo",
"model": "user"
},
"user":{
"type": "belongsTo",
"model": "user"
}
}the relation created in friend collection :

the get friends result (as you can see it has returned the user itself , if I link for ex. 3 users , it returns 3 the same user itself objects):

