In my app I have a 3 layer architecture to represent objects: json, obox and domain. I want to update the Articles of my app through an API call. To parse the users that I receive from the server, I do: ArticleJson.fromJson(item).convertToObox().convertToDomain(), where two converters are two extension function to create the object of the upper layer.
My problem is that when I call convertToDomain(), Bad state: ToOne relation field not initialized. Make sure attach(store) is called before using this. is thrown when I try to access articleGroup.target, and I don't really understand where should I call attach(store).
I overall need to to pass through the Obox level because on the JSON level I just have the foreign key of some properties, instead on the domain level I want to have the object it self, and on the Obox level I build this link.
Build info
Problem
In my app I have a 3 layer architecture to represent objects: json, obox and domain. I want to update the Articles of my app through an API call. To parse the users that I receive from the server, I do:
ArticleJson.fromJson(item).convertToObox().convertToDomain()
, where two converters are two extension function to create the object of the upper layer.My problem is that when I call convertToDomain(),
Bad state: ToOne relation field not initialized. Make sure attach(store) is called before using this.
is thrown when I try to access articleGroup.target, and I don't really understand where should I call attach(store).I overall need to to pass through the Obox level because on the JSON level I just have the foreign key of some properties, instead on the domain level I want to have the object it self, and on the Obox level I build this link.