-
Type:
Task
-
Resolution: Works as Designed
-
Priority:
Trivial - P5
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:
Problem
I want to create two objects Tag and TagCategory such that each Tag must belong to one TagCategory and the latter can have multiple tags associated to itself.
As per the docs, we can use backlinks to define the required inverse relationship.
Unable to find source-code formatter for language: dart. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
@RealmModel() class _TagCategory { @PrimaryKey() late String name; late String description; late List<_Tag> tags; } @RealmModel() class _Tag { @PrimaryKey() late String id; late String name; @Backlink(#tags) late Iterable<_TagCategory> category; }
However, doing so allows Tag to be associated with multiple TagCategories and the Tag.category returns the list of all TagCategories instead of just the one category it belongs to.
Solution
The present solution as per my knowledge is to enforce this at user level code.
Alternatives
No response
How important is this improvement for you?
Would be a major improvement
Feature would mainly be used with
Local Database only