- Notifications
You must be signed in to change notification settings - Fork2.2k
Copy EmbeddedObject on initializing an unmanaged object#7301
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
dianaafanador3 left a comment
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.
Just a minor comments
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
dianaafanador3 left a comment
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.
LGTM, only comment It looks like SwiftLint CI Job is failing, because of format issues.
tgoyne commentedFeb 24, 2022
We only want to copy the object if it's managed. |
Realm/RLMObjectBase.mm Outdated
| if (([objisKindOfClass:cls] && ![(id)clsisEmbedded]) || | ||
| ([(id)clsisEmbedded] && [objrespondsToSelector:@selector(realm)] && ![objrealm])) { |
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.
| if (([objisKindOfClass:cls] && ![(id)clsisEmbedded]) || | |
| ([(id)clsisEmbedded] && [objrespondsToSelector:@selector(realm)] && ![objrealm])) { | |
| if ([objisKindOfClass:cls] && (![(id)clsisEmbedded] || ![objrealm])) { |
I think what you have would callisEmbedded on classes that don't implement it and would accept objects of any type as long as they're an unmanaged embedded object. This also points at some missing tests for initializing an unmanaged object with a value that has an object of a different type in an embedded object field (which copies that object into an unmanaged object of the correct type if all of the required fields are present and have the correct values, and throws an exception if it can't).
Uh oh!
There was an error while loading.Please reload this page.
afsmarques commentedSep 16, 2022
so, no more updates on this? 😕 |
27eee84 to7af1c9cCompared793f69 to62a7f79Compare62a7f79 toeaca6daComparedianaafanador3 commentedFeb 27, 2023
@tgoyne checking this, I think the changes regarding the comments were made, looking at the original issue I think some test are missing what the original intention was, something like the follow. Let me know if there are more changes needed on this, or If I should change the current text with the text above. |
When creating an unmanaged copy of a managed object with the embedded object property we should make a copy of this embedded object instead of reusing it.
This isfix#6921