Be explicit: set RelationDefinition multiple flag

This commit is contained in:
Fabien Franzen 2014-11-24 10:31:28 +01:00
parent d5dcf0a966
commit 77028b07f8
1 changed files with 3 additions and 1 deletions

View File

@ -114,7 +114,7 @@ function RelationDefinition(definition) {
}
this.modelThrough = definition.modelThrough;
this.keyThrough = definition.keyThrough;
this.multiple = (this.type !== 'belongsTo' && this.type !== 'hasOne');
this.multiple = definition.multiple;
this.properties = definition.properties || {};
this.options = definition.options || {};
this.scope = definition.scope;
@ -1139,6 +1139,7 @@ RelationDefinition.belongsTo = function (modelFrom, modelTo, params) {
keyFrom: fk,
keyTo: idName,
modelTo: modelTo,
multiple: false,
properties: params.properties,
scope: params.scope,
options: params.options,
@ -1447,6 +1448,7 @@ RelationDefinition.hasOne = function (modelFrom, modelTo, params) {
keyFrom: pk,
keyTo: fk,
modelTo: modelTo,
multiple: false,
properties: params.properties,
scope: params.scope,
options: params.options,