Permalink
Browse files

fix(Mapping): Check for EntityProxy

  • Loading branch information...
RWOverdijk committed Oct 10, 2016
1 parent b5285d8 commit 27ca374f498779fefcd7d5beaf14d8887cf1cd5c
Showing with 3 additions and 3 deletions.
  1. +3 −2 src/Mapping.ts
  2. +0 −1 src/SchemaBuilder.ts
@@ -3,7 +3,7 @@ import {EntityRepository} from './EntityRepository';
import {MetaData} from './MetaData';
import {EntityManager} from './EntityManager';
import {Scope} from './Scope';
import {EntityCtor, EntityInterface} from './EntityInterface';
import {EntityCtor, EntityInterface, ProxyInterface} from './EntityInterface';
import {ArrayCollection} from './ArrayCollection';
export class Mapping<T> {
@@ -54,7 +54,8 @@ export class Mapping<T> {
*
* @return {Mapping}
*/
public static forEntity<T>(target: EntityCtor<T> | T): Mapping<T> {
public static forEntity<T>(target: EntityCtor<T> | T | ProxyInterface): Mapping<T> {
target = target['isEntityProxy'] ? (target as ProxyInterface).getTarget() : target;
let entity = MetaData.getConstructor(target) as EntityCtor<T>;
let metadata = MetaData.forTarget(entity);
@@ -315,7 +315,6 @@ export class SchemaBuilder {
let uniqueConstraints = mapping.getUniqueConstraints();
Object.getOwnPropertyNames(indexes).forEach(indexName => {
console.log(indexes);
indexBuilder.index(indexes[indexName].map(field => mapping.getColumnName(field)), indexName);
});

0 comments on commit 27ca374

Please sign in to comment.