You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ ] latest
[ ] @next
[X] 0.2.11 (or put your version here)
Steps to reproduce or a small repository showing the problem:
Is there a way to inject clases from outside of the typeorm environment, like a class service. This is what i'm trying to do, but it doesn't work in any way:
We do not know your environment :) so it is hard to help you with this problem. But I do not think so entity is right place to work with services. You should move this functionality to service or another place with business logic.
Note: In current version of typeorm constructor parameters have to be optional (this is subject of change in next version).
@vlapo I can give a use case of this, suppose we have an AWS service and we need to trigger deleteObject method from that service by using @BeforeRemove(), How could you do that?
@vlapo I can give a use case of this, suppose we have an AWS service and we need to trigger deleteObject method from that service by using @BeforeRemove(), How could you do that?
How are you going to rollback if the database operation fails?
This is one of the reasons why (also in domain driven design patterns) entities don't do I/O themselves. And in the above specific case (AWS deleteObject), unless you have a global transaction manager, your best bet is to dispatch a persistent message which will be asynchronously processed outside your database transaction and be "eventually consistent".
Issue type:
[X] question
[ ] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[ ]
mongodb
[ ]
mssql
[ ]
mysql
/mariadb
[ ]
oracle
[X]
postgres
[ ]
cockroachdb
[ ]
sqlite
[ ]
sqljs
[ ]
react-native
[ ]
expo
TypeORM version:
[ ]
latest
[ ]
@next
[X]
0.2.11
(or put your version here)Steps to reproduce or a small repository showing the problem:
Is there a way to inject clases from outside of the typeorm environment, like a class service. This is what i'm trying to do, but it doesn't work in any way:
UsersService being a declared class with dependencies injected into it.
The text was updated successfully, but these errors were encountered: