简体   繁体   中英

Map upper keypath to lower keypath mapping attribute RESTKIT V0.20

"Allocation":{

"UserID":"8bc2df34-b77a-4889-a2ab-559e24cc2d40",

"Answers": 
{
"SurveyInstanceAnswerID":"cb924a6a-ad61-4786-b5fb-00302c4fc7dc",
"SurveyInstanceAllocationID":"42e96cec-5a00-416c-8a96-488ab152e4f5",
"AllocationUniqueRef":"1ce53cdf-b33e-4594-a938-b60656b8b64c",
"SurveyContentID":"ccd07464-9718-4953-8e51-ad25fa00e053",
"AnswerValue":null,
 }
}

I have two classes Allocation with userID and answer with answervalue and userID .

I want to map userid present in allocations with userid in answer class.

I am using rkEntitymapping to map objects

If you use the current development branch (at the time of writing this feature hasn't been merged back to the master branch) you can use metadata to access the parent object during the mapping process:

@metadata.mapping.parentObject

So you can add a mapping:

@"@metadata.mapping.parentObject.UserID" : @"userId"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM