mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Updating entity with relationships does not update parent context #10
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 @andreaperizzato on GitHub (Oct 1, 2015).
Hi,
I have two entities related by a one-to-one relationships (let's call them
AandB) and aListObserverobserving the list ofAs. Both entities conform toImportableUniqueObjectand the relationship is set onAas follows:Then I have an async transaction updating the list of
As.When I commit the transaction, I noticed that only the temporary context is saved, while the parent context is not because its
hasChangesisfalse. This causes the changes not to be merged in the main context has the list observer not to be updated.Removing the relationships from the model solves the problem.
@JohnEstropia commented on GitHub (Oct 1, 2015):
@andreaperizzato
Is the inverse relationship properly set for
other? If so, I don't see why it wouldn't work (we have similar setups in our own project), so there must be something we're missing.Are you sure that
self.otheris being set to a new instance ofOtherUniqueEntity? If the previous value ofself.otheris the same instance returned bytransaction.importUniqueObject(), yourListMonitorwill not receive an update notification (as you have seen wherehasChanges=false).@JohnEstropia commented on GitHub (Oct 3, 2015):
@andreaperizzato Did you resolve this problem?