Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EntityManager is Undefined #88

Open
sgentile opened this issue Feb 25, 2021 · 0 comments
Open

EntityManager is Undefined #88

sgentile opened this issue Feb 25, 2021 · 0 comments

Comments

@sgentile
Copy link

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant