Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Objects can have relationships with other objects. To model this behavior, any ParseObject can be used as a value in other ParseObjects. Internally, the Parse framework will store the referred-to object in just one place, to maintain consistency.
- For example, each Comment in a blogging app might correspond to one Post. To create a new Post with a single Comment, you could write:
- // Create the post
- ParseObject myPost = new ParseObject("Post");
- myPost.put("title", "I'm Hungry");
- myPost.put("content", "Where should we go for lunch?");
- // Create the comment
- ParseObject myComment = new ParseObject("Comment");
- myComment.put("content", "Let's do Sushirrito.");
- // Add a relation between the Post and Comment
- myComment.put("parent", myPost);
- // This will save both myPost and myComment
- myComment.saveInBackground();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement