Merge pull request #357 from fabien/fix/rel-multiple
Set RelationDefinition multiple flag
This commit is contained in:
commit
5255afe9b2
|
@ -114,7 +114,7 @@ function RelationDefinition(definition) {
|
||||||
}
|
}
|
||||||
this.modelThrough = definition.modelThrough;
|
this.modelThrough = definition.modelThrough;
|
||||||
this.keyThrough = definition.keyThrough;
|
this.keyThrough = definition.keyThrough;
|
||||||
this.multiple = (this.type !== 'belongsTo' && this.type !== 'hasOne');
|
this.multiple = definition.multiple;
|
||||||
this.properties = definition.properties || {};
|
this.properties = definition.properties || {};
|
||||||
this.options = definition.options || {};
|
this.options = definition.options || {};
|
||||||
this.scope = definition.scope;
|
this.scope = definition.scope;
|
||||||
|
@ -1139,6 +1139,7 @@ RelationDefinition.belongsTo = function (modelFrom, modelTo, params) {
|
||||||
keyFrom: fk,
|
keyFrom: fk,
|
||||||
keyTo: idName,
|
keyTo: idName,
|
||||||
modelTo: modelTo,
|
modelTo: modelTo,
|
||||||
|
multiple: false,
|
||||||
properties: params.properties,
|
properties: params.properties,
|
||||||
scope: params.scope,
|
scope: params.scope,
|
||||||
options: params.options,
|
options: params.options,
|
||||||
|
@ -1447,6 +1448,7 @@ RelationDefinition.hasOne = function (modelFrom, modelTo, params) {
|
||||||
keyFrom: pk,
|
keyFrom: pk,
|
||||||
keyTo: fk,
|
keyTo: fk,
|
||||||
modelTo: modelTo,
|
modelTo: modelTo,
|
||||||
|
multiple: false,
|
||||||
properties: params.properties,
|
properties: params.properties,
|
||||||
scope: params.scope,
|
scope: params.scope,
|
||||||
options: params.options,
|
options: params.options,
|
||||||
|
|
Loading…
Reference in New Issue