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

Don't persist $manualInputPrice when already existing #2586

Open
thirdknown opened this issue Mar 31, 2023 · 0 comments
Open

Don't persist $manualInputPrice when already existing #2586

thirdknown opened this issue Mar 31, 2023 · 0 comments

Comments

@thirdknown
Copy link
Contributor

Describe the bug

When $manualInputPrice is already existing (loaded from ProductManualInputPriceRepository and not null), it is currently being persisted in the refresh() method of the ProductManualInputPriceFacade class. This may lead to unnecessary persistence and database updates.

Expected behavior

The $manualInputPrice should not be persisted when it is already existing, and only new instances of $manualInputPrice should be persisted.

Steps to reproduce

The issue can be found in the following code snippet from the ProductManualInputPriceFacade class:

https://github.com/shopsys/shopsys/blob/master/packages/framework/src/Model/Product/Pricing/ProductManualInputPriceFacade.php#L47-L58

Possible solution

Only persist the $manualInputPrice when it is newly created, i.e., when it is not loaded from the repository. Update the refresh() method to persist $manualInputPrice only when it is null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants