Skip to content
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

[Bug]: Unable to get parent item properties at backlinks. #1018

Closed
barqui opened this issue Nov 9, 2022 · 4 comments · Fixed by #1020
Closed

[Bug]: Unable to get parent item properties at backlinks. #1018

barqui opened this issue Nov 9, 2022 · 4 comments · Fixed by #1020
Assignees

Comments

@barqui
Copy link

barqui commented Nov 9, 2022

What happened?

Can not get parent properties.

When get parent's property using backlink, realm fire column does not exist exception on child item.
like Unhandled Exception: RealmException: Error getting property ChildModel.name Error: RealmException: Error code: 8 . Message: Column does not exist

Repro steps

run attached codes.

Version

0.7.0rc

What Realm SDK flavor are you using?

Local Database only

What type of application is this?

Flutter Application

Client OS and version

Flutter 3.3.7 ipadOS 16 android 12

Code snippets

void main() {
  final realm =
      Realm(Configuration.inMemory([ParentModel.schema, ChildModel.schema]));

  final child = ChildModel(Uuid.v4(), 'key', 'name');

  realm.write(() {
    final parent = ParentModel(Uuid.v4(), 'pkey', 'pname');
    realm.add(child);
    realm.add(parent);
    parent.children.add(child);
  });

  print(child.name);
  print(child.parents.first.name);
}

@RealmModel()
class $ParentModel {
  @PrimaryKey()
  late Uuid uniqueId;

  @Indexed()
  late String key;

  @Indexed()
  late String name;

  late List<$ChildModel> children;
}

@RealmModel()
class $ChildModel {
  @PrimaryKey()
  late Uuid uniqueId;

  @Indexed()
  late String key;

  @Indexed()
  late String name;

  @Backlink(#children)
  late Iterable<$ParentModel> parents;
}

Stacktrace of the exception/crash you're getting

E/flutter (27850): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: RealmException: Error getting property ChildModel.name Error: RealmException: Error code: 8 . Message: Column does not exist
E/flutter (27850): Exception backtrace:
E/flutter (27850): <backtrace not supported on this platform>
E/flutter (27850): #0      RealmCoreAccessor.get
package:realm/src/realm_object.dart:188
E/flutter (27850): #1      RealmObjectBase.get
package:realm/src/realm_object.dart:272
E/flutter (27850): #2      ParentModel.name
package:realm_test/realm.g.dart:37
E/flutter (27850): #3      main
package:realm_test/realm.dart:19
E/flutter (27850): #4      _runMain.<anonymous closure> (dart:ui/hooks.dart:134:23)
E/flutter (27850): #5      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
E/flutter (27850): #6      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
E/flutter (27850):

Relevant log output

No response

@nielsenko
Copy link
Contributor

@barqui I can reproduce this. Thank you for reporting it. I will get back as soon as I know more.

@nielsenko
Copy link
Contributor

I have PR #1020 ready with a fix. Sorry for the inconvenience.

@nielsenko nielsenko self-assigned this Nov 9, 2022
@barqui
Copy link
Author

barqui commented Nov 11, 2022

@nielsenko
Did you have approximate update date for fix this?
I'm big fan of back link feature and I want to test it asap.

@nielsenko
Copy link
Contributor

Hi @barqui
We are awaiting an important fix for iOS from realm-core before cutting a release. I'm told it should happen today.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants