Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

What is mergeValueForKey:fromManagedObject: used for? #1

Open
onmyway133 opened this issue Aug 10, 2014 · 1 comment
Open

What is mergeValueForKey:fromManagedObject: used for? #1

onmyway133 opened this issue Aug 10, 2014 · 1 comment
Labels

Comments

@onmyway133
Copy link

In MTLManagedObjectAdapater.m

if (managedObject == nil) {
        managedObject = [entityDescriptionClass insertNewObjectForEntityForName:entityName inManagedObjectContext:context];
    } else {
        // Our CoreData store already has data for this model, we need to merge
        [self mergeValuesOfModel:model forKeysFromManagedObject:managedObject];
    }

I see that you give user a chance to merge themselves before those serializeAttribute blocks get called.

I just wonder what mergeValueForKey:fromManagedObject: is used for? It seems to be overridden by serializeAttribute blocks

@nickynick
Copy link
Member

This method is supposed to work the other way around - it may be used to update your model with the values from the existing managed object. Frankly, I don't particularly like how it throws a naked managed object at you, but that's how it is for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants