Start a new topic

KinveyRef - mapping a property inside a Dictionary

Hello,



My problem is with mapping a property inside a Dictionary.



I have a Collection named Fruits of class fruitObj.

I have another collection Garden of class gardenObj.



Inside gardenObj objects I want to store a "contents" Array of Dictionaries withObjectsAndKeys { someQnt,@"quantity",aFruit,@"Fruit"} where "someQnt" stands for quantity of "aFruit" of class fruitObj that already exists in collection Fruits.



How will my aFruit object be stored as a KinveyRef to Fruits Collection?



My store is KCSLinkedAppdataStore.

My problem is with mapping a property inside a Dictionary.





+ (NSDictionary *)kinveyPropertyToCollectionMapping

{

return @{

@"contents.aFruit" : @"movies",

};

}



+(NSDictionary *)kinveyObjectBuilderOptions

{

// reference class map - maps properties to objects

return @{ KCS_REFERENCE_MAP_KEY : @{ @"contents.aFruit" : [fruitObj class]}};

}







Something like this doesn't seem to work



Help!

Thanks


That's exactly what I've been trying to avoid...

...food for thought maybe ;)



Thanks anyway
This set-up is not currently supported. Your best bet would be to create a "fruitcontents" top-level property or store _ids and fetch them after fetching the top object.
There is a mistake above...





(NSDictionary *)kinveyPropertyToCollectionMapping { return @{ @"contents.aFruit" : @"Fruits", }; }

+(NSDictionary *)kinveyObjectBuilderOptions

{

// reference class map - maps properties to objects

return @{ KCS_REFERENCE_MAP_KEY : @{ @"contents.aFruit" : [fruitObj class]}};

}



Login or Signup to post a comment