-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add parent access support on embedded objects #1141
Conversation
# Conflicts: # CHANGELOG.md # packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/ConfigurationImpl.kt # packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt
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.
Nice, only minor comments
packages/library-base/src/commonMain/kotlin/io/realm/kotlin/ext/BacklinksExt.kt
Outdated
Show resolved
Hide resolved
packages/library-base/src/commonMain/kotlin/io/realm/kotlin/ext/BacklinksExt.kt
Outdated
Show resolved
Hide resolved
packages/library-base/src/commonMain/kotlin/io/realm/kotlin/ext/BacklinksExt.kt
Outdated
Show resolved
Hide resolved
...t-base/src/androidAndroidTest/kotlin/io/realm/kotlin/test/shared/EmbeddedRealmObjectTests.kt
Outdated
Show resolved
Hide resolved
# Conflicts: # CHANGELOG.md
…t/BacklinksExt.kt Co-authored-by: Christian Melchior <christian@ilios.dk>
…m-kotlin into ct/backlinks-embedded-objects
Added support for defining backlinks on |
packages/library-base/src/commonMain/kotlin/io/realm/kotlin/ext/EmbeddedRealmObjectExt.kt
Outdated
Show resolved
Hide resolved
packages/library-base/src/commonMain/kotlin/io/realm/kotlin/ext/EmbeddedRealmObjectExt.kt
Outdated
Show resolved
Hide resolved
packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/BacklinksDelegateImpl.kt
Outdated
Show resolved
Hide resolved
@@ -844,7 +846,8 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { | |||
private fun IrType.isLinkingObject(): Boolean { | |||
val propertyClassId = this.classifierOrFail.descriptor.classId | |||
val realmBacklinksClassId = realmBacklinksClass.descriptor.classId | |||
return propertyClassId == realmBacklinksClassId | |||
val realmEmbeddedBacklinksClassId = realmEmbeddedBacklinksClass.descriptor.classId | |||
return propertyClassId == realmBacklinksClassId || propertyClassId == realmEmbeddedBacklinksClassId |
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.
Not sure I get this? Is realmBacklinksClassId
boolean? Would be nice to have the types be part of the properties in this method.
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.
realmBacklinksClassId
isn't a boolean but a ClassId?
. I am going to split the comparison into two methods for clarity.
…t/EmbeddedRealmObjectExt.kt Co-authored-by: Christian Melchior <christian@ilios.dk>
…t/EmbeddedRealmObjectExt.kt Co-authored-by: Christian Melchior <christian@ilios.dk>
# Conflicts: # CHANGELOG.md
Add backlinks support for embedded objects through the
EmbeddedRealmObject.parent()
extension function.It provides access to the parent in runtime, and does not require defining particular property in the model as we need in
backlinks
.closes #1134