Does Objectbox Support having multiple ManyToMany Relations (M:N) ? For example:
// MIX with @Backlink and no @Backlink --> causes Error in this class
@Entity()
class Exercise {
int id;
String title;
String description;
final unitTypes = ToMany<UnitType>();
// Many To Many with Equipment
@Backlink()
final equipments = ToMany<Equipment>();
... Constructor etc.
}
// NO mix with @Backlink and no @Backlink --> no Error in this class
@Entity()
class UnitType{
int id;
String title;
@Backlink()
final exercises = ToMany<Exercises>();
@Backlink()
final units = ToMany<Unit>();
... Constructor etc.
}
@Entity()
class Unit{
int id;
String title;
String short;
final unitType = ToOne<UnitType>();
... Constructor etc.
}
as far as my testing went, all the builds I tried with multiple Many-To-Many Relation in one class failed. Throwing similar errors like this:
could not format because the source could not be parsed:
line 1078, column 212 of .: Expected to find '}'.
╷
1078 │ toManyRelations: (Exercise object) => {RelInfo<Exercise>.toMany(27, object.id): object.unitTypesRelInfo<ExerciseEquipment>.toOneBacklink(3, object.id, (ExerciseEquipment srcObject) => srcObject.exercise): object.exerciseEquipments,
So is there a way to in ObjectBox do make this work, or do I have to use another Binder Class with a One-To-Many Relationship, for example between Exercise and UnitType --> ExerciseUnitType (this workaround has worked for me, but is not pretty and increases the need of additional classes and additional store data significantly)
@Entity()
class ExerciseUnitType{
int id;
String title;
@Backlink()
final exercise= ToOne<Exercise>();
@Backlink()
final unitType = ToOne<UnitType>();
... Constructor etc.
}