This works okay, but when the saveData is left out the newly created child record does not show up in _allchildren. Is this as expected or should this be considered a bug (or is the pseudo-code above correct an did I make a programming error )?
So if you create a child and then set the father id but dont save it yet
Then the relation for child → father is there because we know the father id and do a query on the database
But then relation father → child isnt there yet because the query select pk from child where father_id = x will not give records back until you save.
Fair. I was assuming that _child.child_to_father.father_to_child would resolve to all the children even in the case of unsaved data. So we should never use a relation TO a table that has unsaved records. Is it not possible that an exception is being thrown?
no because it doesnt have to be always a problem for that specific relation…
for example maybe you ask _father2.father_to_child and that will work fine even if child1 (_fater1.father_to_child) is not yet saved.