-
-
Notifications
You must be signed in to change notification settings - Fork 535
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
eager relation load breaks foreign key update #177
Comments
removed redundant `getOneOrFail` in `updateOne`. and introduce `ensureExists` to check record if exist fix #177
I can confirm that I have the same issue. I see that there is a separate branch for the fix... what is the status on the fix? |
@alexmantaut thanks for the attention. you can see after the refactor this issue seems gone. btw, @zMotivat0r When is it released? |
Just tested with next and it seems to work. Looking forward for the next release. |
I'm having the same issue, anyway to hack this until it will be fixed? |
same issue, It's not fix for now. |
oh, it's back again crud/packages/crud-typeorm/src/typeorm-crud.service.ts Lines 181 to 182 in 644acfd
don't need https://typeorm.io/#/repository-api
recently, I have a lot of work to do. It would be great if someone could help to fix. |
I got the same issue and solved it by just override it.
where dto: |
@hsuanyi-chou isn't createOne for creating a new entity? I have also tried with updateOne, but still having issue. |
sorry, my mistake! here is my code.
in frontend, still using patch to update my data with id in params. it doesn't insert a new data, but update the data. frontend angular:
I don't know why.😨 |
I created a PR a couple weeks back that should fix this issue, see #622 - I wanted to ask whether there is anything I could help with to get this PR merged / released? Its a tough year and time is probably short in favor of more important things (health and keeping your sanity in 2020), so let me know what can be done to help. |
I'd like to re-raise this issue @zMotivat0r - Does the PR I submitted look good? I currently need to maintain a fork of the project in our application because this breaks functionality with PATCH. |
a temporary solution:
I use lodash to copy req object with out reference |
Hi all, I'm having the same issue, whether to wait for a fix? |
import { cloneDeep } from 'lodash';
Then in your service
|
It seems being due to a strange TypeORM behaviour. Issue have been raised: typeorm/typeorm#10136 |
When relation set to eager loading, update a foreign key will be failed.
partial entity
When update
catId
it will loadcat
to override the update.crud/packages/crud-typeorm/src/typeorm-crud.service.ts
Lines 122 to 136 in d27a1d6
cat
infound
and onlycatId
indto
The result will be
typeorm
will useobject
instead ofid
The text was updated successfully, but these errors were encountered: