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 instock update in pre-update hook of order detail model #20

Open
stefanheppenheimer opened this issue Jan 4, 2017 · 0 comments
Open
Labels
bug Issues that describe an unexpected behaviour in an existing functionality. minor "bug" issues that are neither "critical" nor "major".

Comments

@stefanheppenheimer
Copy link
Member

stefanheppenheimer commented Jan 4, 2017

The order detail model automatically updates the instock value of the related article detail in a pre-update hook. Unfortunately these updates will not be persisted along with the order detail. This is due to the fact that according to the doctrine documentation changes made to an entity inside a pre-update hook will not be committed in the same flush event as the "host" entity. Therefore these changes will stay "pending" until the next (global) flush event. This makes the automatic update of the instock value unpredictable and leads in fact to a lot of problems especially in the order cancellation. Therefore we should fix the automatic update and send Shopware a pull request.

http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#preupdate

Shopware 5.2.12 (Order Detail Model)
https://github.com/shopware/shopware/blob/v5.2.12/engine/Shopware/Models/Order/Detail.php#L607-L640

@stefanheppenheimer stefanheppenheimer changed the title Fix instock update in pre-update hook of order dezail Fix instock update in pre-update hook of order detail model Jan 4, 2017
@svenmuennich svenmuennich added bug Issues that describe an unexpected behaviour in an existing functionality. minor "bug" issues that are neither "critical" nor "major". labels Feb 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that describe an unexpected behaviour in an existing functionality. minor "bug" issues that are neither "critical" nor "major".
Projects
None yet
Development

No branches or pull requests

2 participants