Mantle / MTLManagedObjectAdapter

Core Data support for Mantle
https://github.com/Mantle/Mantle
MIT License
140 stars 55 forks source link

How to support relationship inverse? #17

Closed zhima closed 9 years ago

zhima commented 9 years ago

Now I have two MTLModel named Parent and Children, which correspond with NSManagedObject Parent and Children.

The entity Parent has a relationship named children to Children, and Children also has an inverse relationship named parent to Parent.

I can use the + (NSDictionary *)relationshipModelClassesByPropertyKey method to support Parent's children relationship, but I can'f find any method to support inverse relationship of Children.

alexvbush commented 8 years ago

@zhima did you manage to make it work? I'm having the same problem where mantle sets one to many right but doesn't set the inverse relationship for children objects

zhima commented 8 years ago

@alexvbush Yeah, I have figured it out. When you have configured the inverse relationship properly in core data model, then it will automatically add the inverse relation from children to parent when inserting managed objects.