Skip to content

Commit

Permalink
feat(Scope): register reference with identity map
Browse files Browse the repository at this point in the history
  • Loading branch information
RWOverdijk committed Jan 22, 2017
1 parent d356b97 commit c82e7ca
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Scope.ts
Expand Up @@ -8,7 +8,6 @@ import {Wetland} from './Wetland';
import {Hydrator} from './Hydrator';
import {Homefront} from 'homefront';
import {EntityProxy} from './EntityProxy';
import {ArrayCollection} from './ArrayCollection';
import {IdentityMap} from './IdentityMap';

export class Scope {
Expand Down Expand Up @@ -84,7 +83,7 @@ export class Scope {
*
* @param {Entity} entity
* @param {*} primaryKeyValue
* @param {boolean} proxy Whether or not to proxy the reference (if used for updates for instance).
* @param {boolean} [proxy] Whether or not to proxy the reference (if used for updates for instance).
*
* @returns {EntityInterface}
*/
Expand All @@ -103,7 +102,11 @@ export class Scope {
this.unitOfWork.registerClean(reference);

if (proxy) {
return this.attach(reference);
let proxied = this.attach(reference);

this.identityMap.register(ReferenceClass, proxied);

return proxied;
}

return reference;
Expand Down

0 comments on commit c82e7ca

Please sign in to comment.