Skip to content
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

Fix issue with deleted images after try to remove the product #8909

Closed
wants to merge 2 commits into from

Conversation

GSadee
Copy link
Member

@GSadee GSadee commented Oct 26, 2017

Q A
Branch? 1.0
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets fixes #8899
License MIT

@GSadee GSadee added the Bug Fix label Oct 26, 2017
@GSadee GSadee added this to the 1.0 milestone Oct 26, 2017
@GSadee GSadee force-pushed the deleted-images-issue branch from 99e09d6 to 5af2ced Compare October 26, 2017 14:01
@GSadee GSadee changed the title [WIP] Fix issue with deleted images after try to remove the product Fix issue with deleted images after try to remove the product Oct 26, 2017
@pamil pamil added Potential Bug Potential bugs or bugfixes, that needs to be reproduced. and removed Bug Fix labels Oct 27, 2017
@deniskrasilnikov
Copy link

deniskrasilnikov commented Nov 23, 2017

My conclusion after current issue research is so, that doing any kinds of file deletion on ORM postRemove is wrong because ORM events happen inside implicit begin/commit transaction of UnitOfWork and does not guarantee that entity will be really physically removed from db (e.g. FK constraints issues). That actually said in Doctrine ORM events doc page. Depending on the context i see next possible solutions:

  1. Image removal can be done on Sylius resource post_delete event of the image(s) owning entity. Suitable for the cases of image aware resources deletion like product or taxon, when we for sure want delete all related pictures.
  2. On Doctrine ORM postRemove use some special service for postponed image file deletion . So here we just add image-entity to service. Later on, using listener over Doctrine postFlush event we access that service and ask him to do actual removal of all accumulated images (post-flush event is the last one always and happens AFTER real implicit transaction was committed). This is generic case solution which seems to be working without any specific context knowledge (for explicit image removal from ORM in own code, via cascading entity operations on relations, etc).

Any chances the issue fix will appear in 1.1?

@pamil pamil removed this from the 1.0 milestone Apr 27, 2018
@GSadee
Copy link
Member Author

GSadee commented Nov 12, 2018

Closing in favour of #9906

@GSadee GSadee closed this Nov 12, 2018
@GSadee GSadee deleted the deleted-images-issue branch November 12, 2018 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug Potential bugs or bugfixes, that needs to be reproduced.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants