-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
#6613 #6614 correct handling of new elements added to an initialized (yet dirty) collection #6616
Merged
Ocramius
merged 23 commits into
master
from
fix/#6614-clean-modified-collection-causing-double-dirty-object-persistence
Aug 11, 2017
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
874d60d
It added the unit test #6613
Sysaninster 594e60d
#6613 #6614 simplifying entity definition - using auto-assigned strin…
Ocramius 0a1a841
#6613 #6614 better test specification - removing useless assertions
Ocramius 112a402
#6613 #6614 smashing entity definitions into the test
Ocramius 625f792
#6613 #6614 removing dedicated DDC6613 model directory
Ocramius c195064
#6613 #6614 CS - applying `@group` annotation to the test
Ocramius eca1d6b
#6613 #6614 rewrote test logic to be less magic-constant-dependent
Ocramius a4e547b
#6613 #6614 remove superfluous mappings
Ocramius 80f12ed
#6613 #6614 correcting column mapping (was `integer`, should be `stri…
Ocramius 8c4b5a4
#6613 #6614 removing phone/user specifics, using ORM naming for assoc…
Ocramius d2c9b22
#6613 #6614 removing IDE-generated header
Ocramius 5e2257d
#6613 #6614 adding assertions about collection initialization and dir…
Ocramius 1fc7f81
#6613 #6614 after initialization, the collection should be dirty anyway
Ocramius d44e6e1
#6613 #6614 ensuring that only newly added items that weren't loaded …
Ocramius 031e79e
#6613 #6614 correcting broken test that isn't using objects against a…
Ocramius 345cf1a
#6613 #6614 correcting broken test that isn't using objects against a…
Ocramius 04a5b12
#6613 #6614 #6616 moved integration test basics to a unit test that v…
Ocramius 93c4064
#6613 #6614 #6616 initializing a dirty collection that has new items …
Ocramius b064fe3
#6613 #6614 #6616 removing repeated `PersistentCollectionTest` chunks…
Ocramius 1174ec6
Add failing test for dirty flag
alcaeus a2ca6bb
#6613 #6614 #6616 ensuring that the collection is marked as non-dirty…
Ocramius 3579997
#6613 #6614 #6616 removing DDC6613 test, which was fully ported to un…
Ocramius 004ac51
#6613 #6614 #6616 minor performance optimisations around the new `res…
Ocramius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think the issue could be solved by only not calling
clear()
here.IIRC,
UnitOfWork
already handles dirty elements in the collection and does not replace them when hydrating inBasicEntityPersister::loadCollectionFromStatement
(which is where all calls go at the end).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.
That's not the case: removing the
clear()
causes this test to fail, as well as another 3: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.
I think the current solution is a decent one, as it keeps the responsibility of re-attaching the
NEW
records within thePersistentCollection
implementation. Distributing it around multiple objects may be better for performance, but is actually a mess to track on the long term