-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best way to map subrequest without manual add/remove #32
Comments
@k06a basically all you need is to "replace" old menus by new one with reuse of existing? Am i right? In this case this code should help you: FEMManagedObjectMapping *placeMapping = ...;
FEMManagedObjectMapping *menuMapping = ...;
FEMRelationship *menuRelationship = [[FEMRelationship alloc] initWithProperty:@"menuRelationshipPropertyNameForPlace" keyPath:@"keyPathForMenusInJSON" assignmentPolicy:FEMAssignmentPolicyCollectionReplace objectMapping:menuMapping];
[placeMapping addRelationship:menuRelationship]; |
@k06a |
@dimazen, |
@k06a ok, in this way you probably need something like that: EMManagedObjectMapping *placeMapping = empty mapping with entity name. ;
FEMManagedObjectMapping *menuMapping = real mapping of menu;
FEMRelationship *menuRelationship = [[FEMRelationship alloc] initWithProperty:@"menuRelationshipPropertyNameForPlace" keyPath:nil assignmentPolicy:FEMAssignmentPolicyCollectionReplace objectMapping:menuMapping];
[placeMapping addRelationship:menuRelationship]; After you're done with mapping execute this code [FEMManagedObjectDeserializer fillObject:userPlace fromExternalRepresentation:dictionaryFromNetwork usingMapping:placeMapping];
|
@dimazen thanks! |
@dimazen I am using
I found similar problem and similar solution here: #26 But it is not working for me. |
@k06a hm, can you share the JSON & mapping? |
I am using request to get places:
Then I need to make request:
I am doing this way:
For each place I am doing request and mapping like this this:
And then I am trying to determine menus to add and to remove from
place
objects:Really I don't wanna use this code :) I wanna Fast and Easy Mapping. Please tell me how to avoid this code with FAM.
The text was updated successfully, but these errors were encountered: