mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
ImportableUniqueObjects from nested JSON #195
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lepunk on GitHub (Dec 10, 2017).
Hi, this is driving me crazy. Not sure if its a bug in CoreStore or I'm doing something wrong (most likely its me)
I have 2 entities: Coin and Exchange. Coin has an "exchanges" relationship to many Exchange
My json looks something like this:
I have the following ImportableUniqueObject extensions
and
And finally my import code is
...where JSON is a SwiftyJSON object
My problem is that this code is not importing relationships correctly. If I print out the exchanges length in the Coin entity's update method it prints the correct value.
However if later on I fetch the Coin and print out the relationship's length its invalid and it varies each time i re-sync
Any help is appreciated and thanks for the amazing library
@JohnEstropia commented on GitHub (Dec 10, 2017):
@lepunk Just a hunch, but have you checked that your relationships have the inverse relationship set on both entities?
@lepunk commented on GitHub (Dec 10, 2017):
@JohnEstropia you are my hero. spent most of my weekend figuring it out. can't believe the solution was this easy. thanks a bunch
@JohnEstropia commented on GitHub (Dec 10, 2017):
Wow, lucky guess :D Cheers!