Comments (4)
There are some problems with circular dependencies and decorators, but as far as I know, in this case @InjectRepository(class)
will be fine even if class
has circular deps inside. I actually tested this against hundred of repositories already.
from typeorm.
Thanks for the answer. In fact, I did some tests wrong and it seems that this wasn't faulty in my code. Mostly the issue I had is that my NestJS service used some TypeORM repository and the same TypeORM entity was doing a call back (through some other files/logic) to the same service.
In sum, I had a circular dependency, which typescript didn't report and the only message I got was that the class was undefined inside the @Injectrepository(class)
. And this class wasn't even the one having the issue of the circular dependency.
I guess this is something in a higher level, in TypeScript, that is not detected there... But also could be good to warn the user that if this class passed in @Injectrepository(class)
is undefined, there is a high possibility that there is a circular dependency somehow!
from typeorm.
I added an additional check in 6.1.0 :)
from typeorm.
@kamilmysliwiec is it possible to know what's involved in the circular dependency? I had the problem that InjectRepository was trying to inject a null entity, now it seems that the code checks if it's null but I don't see how my code is circularly dependent as I've just added an entity custom validation constraint the injects the above class repository in its constructor
from typeorm.
Related Issues (20)
- '"typeorm"' has no exported member named 'InjectRepository'. Did you mean 'getRepository'? HOT 3
- setting synchronize to true gives me a typeorm error HOT 1
- When a custom converter is used on a column, migration fails.(nestjs+typeorm) HOT 1
- Testing mocker issues HOT 1
- Option to not initialize DataSource in createDataSourceFactory HOT 6
- Many to many relation is finding a column that doesn't exists HOT 1
- Polymorphic association #12750 HOT 1
- createTypeOrmProviders should inject EntityManager instead of Connection HOT 1
- Bring back keepConnectionAlive HOT 1
- auto db connection close problem When Execute Graceful shtudown with pm2 HOT 1
- Every migration:generate creates DROP/CREATES constraints and keys HOT 1
- Inject ConfigService into an Entity or Subscriber HOT 4
- Nestjs warns about "TypeOrmModule" taking a long time to serialize HOT 8
- TypeOrmModule makes @Request() unusable HOT 1
- When connectionstring param used, Hostname and database name are not correctly extracted HOT 2
- perhaps Typeorm module didn't passing request response to controller HOT 2
- Check whether the object passed is an entity HOT 2
- missing connect/error hook/event HOT 1
- Cannot read properties of undefined (reading 'retryAttempts') when start the app on production. HOT 1
- Typeorm prevents Req Res Body decorators from working in version 10.0.2 with typeorm package 0.3.20 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typeorm.