Skip to content

Commit

Permalink
Merge 403488a into cb57a42
Browse files Browse the repository at this point in the history
  • Loading branch information
clayrisser committed Dec 4, 2018
2 parents cb57a42 + 403488a commit 98ab49d
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion packages/repository/src/repositories/legacy-juggler-bridge.ts
Expand Up @@ -143,6 +143,29 @@ export class DefaultCrudRepository<T extends Entity, ID>
this.modelClass.attachTo(dataSource);
}

/**
* @deprecated
* Function to create a constrained relation repository factory
*
* Use `this.createHasManyRepositoryFactoryFor()` instaed
*
* @param relationName Name of the relation defined on the source model
* @param targetRepo Target repository instance
*/
protected _createHasManyRepositoryFactoryFor<
Target extends Entity,
TargetID,
ForeignKeyType
>(
relationName: string,
targetRepoGetter: Getter<EntityCrudRepository<Target, TargetID>>,
): HasManyRepositoryFactory<Target, ForeignKeyType> {
return this.createHasManyRepositoryFactoryFor(
relationName,
targetRepoGetter,
);
}

/**
* Function to create a constrained relation repository factory
*
Expand All @@ -169,7 +192,7 @@ export class DefaultCrudRepository<T extends Entity, ID>
* @param relationName Name of the relation defined on the source model
* @param targetRepo Target repository instance
*/
protected _createHasManyRepositoryFactoryFor<
protected createHasManyRepositoryFactoryFor<
Target extends Entity,
TargetID,
ForeignKeyType
Expand All @@ -184,9 +207,31 @@ export class DefaultCrudRepository<T extends Entity, ID>
);
}

/**
* @deprecated
* Function to create a belongs to accessor
*
* Use `this.createBelongsToAccessorFor()` instaed
*
* @param relationName Name of the relation defined on the source model
* @param targetRepo Target repository instance
*/
protected _createBelongsToAccessorFor<Target extends Entity, TargetId>(
relationName: string,
targetRepoGetter: Getter<EntityCrudRepository<Target, TargetId>>,
): BelongsToAccessor<Target, ID> {
return this.createBelongsToAccessorFor(relationName, targetRepoGetter);
}

/**
* Function to create a belongs to accessor
*
* @param relationName Name of the relation defined on the source model
* @param targetRepo Target repository instance
*/
protected createBelongsToAccessorFor<Target extends Entity, TargetId>(
relationName: string,
targetRepoGetter: Getter<EntityCrudRepository<Target, TargetId>>,
): BelongsToAccessor<Target, ID> {
const meta = this.entityClass.definition.relations[relationName];
return createBelongsToAccessor<Target, TargetId, T, ID>(
Expand Down

0 comments on commit 98ab49d

Please sign in to comment.