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
Cascade softRemove on relations #30
Comments
Hi, can you show me the code of I am sorry for missing the notify. |
@iWinston Is cascade supported in Typeorm or only in Typeorm+? I mentioned it at : typeorm/typeorm#5034 (comment) |
@iWinston this is the code fot async getById(id: string): Promise<Client> {
return this.clientRepository.findOne({ id, tenant: this.tenant })
} |
@Abdizriel how did you solve the circular dependency by using cascade: true in both the entity and the child entity? and what does @type decorator does? |
@ruslanguns I had to remove one cascade true and I did it from a child (Patient) |
@Abdizriel Maybe you can try this:
|
@iWinston How can I find softdeleted users? .... I just edited my comment at typeorm/typeorm#5034 (comment) |
@iWinston Yeah, that one worked however then in case of softRemove I have to add everywhere relations since it doesn't work with lazy loading. |
Nevermind, just discovered it by myself using { withDeleted: true } .... thank you @iWinston for this great feature!! |
@Abdizriel Maybe you can try eager relations if you want it to be loaded automatically. |
@iWinston Sorry for late reply, it worked as you said! Thank you very much for help with this. One last question - How I can include soft deleted entry from relations to a response from repository? Since I can do it for a main entity |
@Abdizriel It will always include soft deleted entry from relations to a response from repository by default. |
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:
[x]
latest
[ ]
@next
[ ]
0.x.x
(or put your version here)Steps to reproduce or a small repository showing the problem:
I have an issue with a cascade softRemove on relations. This is the entry for a Client table
So when i do softRemove on a client entry it should do softRemove on all patients. This is how I do softRemove on my service:
It soft removed a client correctly however all patients where client is the owner are not soft removed. Could you point where the error is? I have even tried this but it also didn't worked:
or even on the Patient table which also didn't worked
The text was updated successfully, but these errors were encountered: