2

I'm wondering on how to use the Relation column in Parse, I have been looking for this and I didn't find much information about this, I found the link below : Parse Relations Developer Guide

But I didn't find helpful information, anyway I have a Publications Class et a Comments Class, each publication has different comments,

so how I would be able to use this, and get for example all the comments for one publication.

That would be very helpful.

1 Answer 1

3

I have found how to do that, looking on Parse Developer Guide :

Here is how to insert comment to a publication for example :

 commentaire = new ParseObject("Commentaires"); 
    commentaire.put("commentaire", "test1");
    commentaire.saveInBackground(new SaveCallback() {
       public void done(ParseException e) {
          message.getRelation("commentaires").add(commentaire);
      message.saveInBackground();

Retrieving is more simple :

ParseUser user = ParseUser.getCurrentUser();
ParseRelation<ParseObject> relation = user.getRelation("commentaires");

I hope this will help someone

For more info check : Parse Developer Guide

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.