-
Notifications
You must be signed in to change notification settings - Fork 213
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
feat(): Add support for [email protected] literal repositories #383 #384
Conversation
entity.prototype instanceof AbstractRepository | ||
typeof Repository === 'function' && | ||
(entity.prototype instanceof Repository || | ||
entity.prototype instanceof AbstractRepository) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw what about custom repositories in 0.3.0. Are they going to be deprecated/removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can extend a repository with custom methods by calling extend()
on a repository instance:
repository.extend({
customMethod() {
// ...
}
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kamilmysliwiec now (0.3.0) @EntityRepository()
is deprecated. Here's how we should use instead: https://github.com/typeorm/typeorm/blob/master/docs/custom-repository.md
This PR is 2 years old so it may contain outdated code. Let me just close it and create a new one for migrating to the latest version of TypeORM |
@kamilmysliwiec Any luck with this? I'm starting a new project, and if NestJS is on the precipice of migrating, I'd rather commit to the latest version of TypeORM over using outdated approaches. |
I've started 10 days ago and I noticed that TypeORM Readme & docs were still not even updated to the latest version so I figured I'll have to wait at least a few days more before I can jump onto this issue. |
@derekcunningham-ab I've created a fork for myself, which seems to work fine as a temporary solution. Maybe you can use it until the official nestjs module is updated, if you don't want to wait. |
It seems that the documentation is now updated |
bump |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #383
What is the new behavior?
Check if
Repository
is a function to determine if[email protected]
is being used and if so then use the literal repository object to generate repository injection token.Does this PR introduce a breaking change?
Other information
Tests are passing for current
[email protected]
but failing for[email protected]
due toRepository
no longer being a function. The custom repository also needs to be refactored: https://github.com/nestjs/typeorm/blob/master/tests/src/photo/photo.repository.ts#L5