EntityManager is Undefined
sgentile opened this issue · 0 comments
sgentile commented
I setup per the documentation, but when this is called entitymanager is undefined:
save<T extends DeepPartial<Entity>>(entityOrEntities: T|T[], options?: SaveOptions): Promise<T|T[]> {
return this.manager.save<T>(this.metadata.target as any, entityOrEntities as any, options);
}
my index:
initializeTransactionalContext();
serve();
my respository:
@EntityRepository(User)
export class UserRepository extends BaseRepository<User> {}
my service injecting it
export class UserService {
constructor(
private readonly userRepository: UserRepository
) {}
lastly the call to save
return await this.userRepository.save(user);