Skip to content

Commit

Permalink
fix(core): wrap relations in Reference wrapper when assigning entit…
Browse files Browse the repository at this point in the history
…y instance

Closes #3092
  • Loading branch information
B4nan committed May 18, 2022
1 parent edec290 commit 97f1f59
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/entity/EntityAssigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class EntityAssigner {

private static assignReference<T extends AnyEntity<T>>(entity: T, value: any, prop: EntityProperty, em: EntityManager, options: AssignOptions): void {
if (Utils.isEntity(value, true)) {
entity[prop.name] = value;
entity[prop.name] = Reference.wrapReference(value, prop);
} else if (Utils.isPrimaryKey(value, true)) {
entity[prop.name] = prop.mapToPk ? value : Reference.wrapReference(em.getReference<T>(prop.type, value, options), prop);
} else if (Utils.isPlainObject(value) && options.merge) {
Expand Down

0 comments on commit 97f1f59

Please sign in to comment.