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

Version conflict #57

Open
migo315 opened this issue Apr 15, 2020 · 2 comments
Open

Version conflict #57

migo315 opened this issue Apr 15, 2020 · 2 comments
Assignees

Comments

@migo315
Copy link
Contributor

migo315 commented Apr 15, 2020

After updating to current master version, I get a lot of version conflicts:

Object 86cf4956-c4b4-4822-9400-4c9faf890e78 has a different version than expected. Expected: 2 - Actual: 3

Workaround (credit by @bestit-el-bardan):
Use detachDeferred before flush.

            $this->odm->detachDeferred($productType);
            $this->odm->flush();
@bestit-el-bardan
Copy link
Contributor

To expand on this, there seems to be an issue in https://github.com/bestit/commercetools-odm/blob/master/src/UnitOfWork.php#L1108
It flushes multiple times, even if the first run was successful and it shouldn't actually flush a second time.

The workaround works due to the logic in the PersistResponseHandler https://github.com/bestit/commercetools-odm/blob/master/src/UnitOfWork/ResponseHandlers/PersistResponseHandler.php#L75 so it gets detached and the "isObjectManaged" check returns false.

This seems like a bug though as it should work without manually calling detachDeferred

@b3nl
Copy link
Contributor

b3nl commented Sep 1, 2020

sorry, dont understand this topic.

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

No branches or pull requests

3 participants