-
-
Notifications
You must be signed in to change notification settings - Fork 509
Remove embedded documents complexity #782
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
Conversation
jwage
commented
Jan 25, 2014
- Remove some of the additional complexity when working with embedded documents. Treat embedded documents like normal documents in the UnitOfWork as much as possible.
- Fix issue with ClassMetadata::associationMapping not inheriting associations correctly.
- Fix issue with re-persisting removed embedded document. Make it possible to re-persist removed embeded documents #719
- Fixes Document is upserted and then updated during one flush operation #1058, Fix changeset handling for new documents #999, Document is upserted and then updated during one flush operation #1059, UnitOfWork problem due to spl_object_hash collision #1017
*/ | ||
private function computeAssociationChanges($parentDocument, $mapping, $value) | ||
private function computeAssociationChanges($parentDocument, $assoc, $value) |
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.
Type-hint $assoc
as array
here?
@jwage: Is this still in progress? |
@jmikola yes it is, I just haven't had time to continue working on it. |
acf9508
to
950dce6
Compare
df3fc9d
to
c3c6016
Compare
…ument a spl_object_hash collision occurs.
Looks good to me. The issues I previously reported are gone. 👍 |
@AronSzigetvari got any feedback for me by any chance? :) |
@malarzm, I have made a testing for the original problem and it seems to be OK, but I still have a failing test in the application test suite that I want to simplify to a minimal test or find out if we just used it wrong and had worked until now just because of some quirk. |
@AronSzigetvari sure, do you think you'll be able to pull it together today or tomorrow? |
@malarzm I am on it now so I very much hope so. |
@AronSzigetvari thank you very much! 👍 |
@malarzm I have found the cause of our failing test, but I am not sure if it is a bug or not (a feature, or a fix of a previous bug): Scenario: merging 2 carts. Cart is document, Item is embeddedDocument. I could make the test pass 2 different ways:
It makes sense since remove is cascaded, but it used to work differently before, (however, persist should be also cascaded) What do you think? |
@AronSzigetvari I would love to be able to just reuse embedded documents by passing them around to different documents but unfortunately we're not aware of any good solution for that :( I'd suggest going down 1), I'm personally always (deep) cloning objects that are about to change owner to ensure nothing will clash or have any side effects. |
Merged manually in b1089b7. @AronSzigetvari @blockjon @alcaeus @danez thank you very much for all your help! |
I have made a test that creates an owner document and an embedded document inside, then replaces the embedded, creates a new one with colliding hash value and checks the document state in the UOW. This fails with BETA10 and passes after this fix. |
@AronSzigetvari I've merged @danez test in 4817908 but if you think it's not enough feel free to submit a PR with passing test only :) |