-
-
Notifications
You must be signed in to change notification settings - Fork 754
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
Fixed #1225 #1226
Fixed #1225 #1226
Conversation
I have checked this PR and it is working fine. |
{ | ||
$organization = $this->model->findOrFail($id); | ||
|
||
$organization->persons->each->delete(); |
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.
This will cause DDOS. Use single query to delete all the persons.
$organization->persons()->delete();
|
||
$organization->persons()->delete(); | ||
|
||
$this->attributeValueRepository->deleteWhere([ |
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.
This will remove all other entities also. Add entity_type as well.
$organization->persons()->delete(); | ||
|
||
$this->attributeValueRepository->deleteWhere([ | ||
'entity_id' => $id, | ||
'entity_type' => 'organizations', | ||
]); | ||
|
||
$organization->delete($id); |
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.
Wrap this multiple deletion in transaction to make it atomic.
fixed for #1225
on organization delete, persons are removed but can't be saved again.
removed attribute values of persons on organization delete.