On Feb 22, 2014, at 2:39 PM, Joel Saltzman <[email protected]> wrote:

> Let's say I have a model (subclass of CBLModel) with many children. 
> Is this the suggested way of setting up the relationship? 

Yes; assuming that you've defined a MyModel.children property, marked it as 
@dynamic in the implementation, and implemented a +childrenItemClass method 
that returns MyModel.

> Is there a better way to do it so when the parent gets deleted, the children 
> get deleted too?


No, there's no support for cascading deletes. CBLModel doesn't do everything 
CoreData does, although it does keep getting closer.
If you want this behavior you'd need to override -deleteDocument: and delete 
each of the child objects. (You might need some kind of protection against 
infinite regress, if your relationship can have cycles.)

--Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/E2167286-BCCA-472B-99CD-2F20994431A4%40couchbase.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to