Hi,
I wanna understand better the relations management introduced with Backendless 4.
Imagine this scenario:
class Parent: BackendlessEntity {
var name: String?
var child: Child?
}
and the child:
class Child: BackendlessEntity {
var name: String?
var age: Int?
}
Then I created the instances and setup the relations.
let child = Child()
child.name = "Jonh junior"
child.age = 32
let parent = Parent()
parent.name = "Jonh"
parent.child = child
With Backendless 3 the following code create automatically the “Parent” and the “Child” table, save the child and the parent objects and create a 1:1 relation between them:
Backendless.sharedInstance()?.data.of(Parent.ofClass()).save(parent, response: { (response) in
print(response)
}, error: { (fault) in
print(fault)
})
With a test I notice that this doesn’t works with the new version of Backendless.
Reading the documentation I notice that we have to make many additional step for doing this:
- save the child object
save the parent object
create a relation by using dataStore?.setRelation API (create it automatically the column in the Parent table?)
Why now we have to make 3 different service calls?
Thanks,
Matteo