I have this data model:
Album <--->> Photo <--->> Like <<---> User
I want to get the photos from specific Album and I want to attach Likes to them as well. I would like to have some equivalent of a Fetched Property, because I don't want to get an array of likes to each photo, I just want to have the one like.
Here's related Backendless support question: http://support.backendless.com/topic/join-equivalent-for-find-fetched-properties
2 Answers
Answers 1
You can apply complex NSPredicate to the fetch request, it can analyse both the direct attributes of the target entity of a fetch and the attributes of its relationships
Try :
NSPredicate(format: "(albums = %@) AND (SUBQUERY(likes, $l, $l IN %@).@count > 0)", album, user.likes)
Answers 2
you should use core data as it is using ORM it will satisfy all your needs
0 comments:
Post a Comment