This commit is contained in:
parent
e4c602b098
commit
9806feb397
|
@ -865,7 +865,13 @@ var throughKeys = function(definition) {
|
|||
var fk2 = definition.keyThrough;
|
||||
}
|
||||
} else if (definition.modelFrom === definition.modelTo) {
|
||||
return findBelongsTo(modelThrough, definition.modelTo, pk2);
|
||||
return findBelongsTo(modelThrough, definition.modelTo, pk2).
|
||||
sort(function (fk1, fk2) {
|
||||
//Fix for bug - https://github.com/strongloop/loopback-datasource-juggler/issues/571
|
||||
//Make sure that first key is mapped to modelFrom
|
||||
//& second key to modelTo. Order matters
|
||||
return (definition.keyTo === fk1) ? -1 : 1;
|
||||
});
|
||||
} else {
|
||||
var fk1 = findBelongsTo(modelThrough, definition.modelFrom,
|
||||
definition.keyFrom)[0];
|
||||
|
|
Loading…
Reference in New Issue