Merge entity associated to versioned entity#1573
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Please, remove this empty line
Contributor
There was a problem hiding this comment.
I think it may be clearer to flip this function and rewrite it as a positive-question, where you're asking if the entity has any data to work with.
private function isLoaded($entity){
return !($entity instanceof Proxy) || $entity->__isInitialized();
}
Other possible names that come to mind are hasData() or isInitialized(). (Assuming that non-proxies are considered initialized too.)
Contributor
There was a problem hiding this comment.
Does this need a public $tags earlier on?
Ocramius
added a commit
that referenced
this pull request
Dec 11, 2015
Ocramius
added a commit
that referenced
this pull request
Dec 11, 2015
Ocramius
added a commit
that referenced
this pull request
Dec 11, 2015
…nd bi-directional association
Ocramius
added a commit
that referenced
this pull request
Dec 11, 2015
Ocramius
added a commit
that referenced
this pull request
Dec 11, 2015
Ocramius
added a commit
that referenced
this pull request
Dec 11, 2015
Ocramius
added a commit
that referenced
this pull request
Dec 11, 2015
…nd bi-directional association
Ocramius
added a commit
that referenced
this pull request
Dec 11, 2015
Member
|
Merged, thanks! Backported also in 2.5.x via 62719f2 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I wrote a unit test that reveal the bug and a fix.
If I merge an entity which is associated to a versioned entity this fire a OptimisticLockException as the managedCopy is a Proxy so the version attribute is always null.
I think when we compare version attribute, we should skip it when one of the entity or the managed copy is a Proxy not initialized.