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

@EntityRepository is deprecated #43

Open
xarielah opened this issue Dec 16, 2022 · 3 comments
Open

@EntityRepository is deprecated #43

xarielah opened this issue Dec 16, 2022 · 3 comments

Comments

@xarielah
Copy link

This decorator of which using to create custom repositories is deprecated.
Please be aware Ariel :)

@CaesarBourne
Copy link

create a custom repository like below and use it as the entity repository, passing the entity as an argument

export function CustomRepository(entity: Function): ClassDecorator {
return SetMetadata(TYPEORM_EX_CUSTOM_REPOSITORY, entity);
}

@CustomRepository(Task)
export class TaskRepository extends Repository {
constructor(private dataSource: DataSource) {
super(Task, dataSource.createEntityManager());
}

@mertkaanguzel
Copy link

I tried the solution on the Stackoverflow. It works but it doesn't use EntityRepository or CustomRepositoy decorators.

@xwlee
Copy link

xwlee commented Nov 12, 2023

https://github.com/xwlee/nestjs-task-management/blob/main/src/tasks/tasks.repository.ts

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

4 participants