Skip to content

ParseRelation #399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LavTeamProject opened this issue Jul 4, 2020 · 5 comments
Closed

ParseRelation #399

LavTeamProject opened this issue Jul 4, 2020 · 5 comments

Comments

@LavTeamProject
Copy link

LavTeamProject commented Jul 4, 2020

version: "1.0.26"

  1. I added a column "Rela" (Relations to table Test1)

Снимок экрана 2020-07-04 в 23 08 38

  1. dietPlan.addRelation('rela', [ParseObject("Test1")..set("objectId", "BHfYX9IibU")]);

Снимок экрана 2020-07-04 в 23 08 52

  1. Now I want to get this object:
    final ParseRelation rela = dietPlan.rela;
    var test = rela.getQuery();
    var apiResponse = test.query().then((value) {
    print(value.result);
    //console log:
    //[{"className":"Test1","objectId":"BHfYX9IibU","createdAt":"2020-06-27T08:05:28.397Z","updatedAt":"2020-07-04T19:40:25.045Z","title":"test1","testPF":{"__type":"Pointer","className":"Test2","objectId":"r5iLCHPMiS"},"title2":"123","title3":"123","testRL":{"__type":"Relation","className":null,"objects":null}}, {"className":"Test1","objectId":"3nIgR8jZsB","createdAt":"2020-06-27T08:56:40.729Z","updatedAt":"2020-06-27T09:29:50.750Z","title":"test2","testPF":{"__type":"Pointer","className":"Test2","objectId":"0RhHh8OXFB"},"title2":"4","title3":"1","testRL":{"__type":"Relation","className":null,"objects":null}}, {"className":"Test1","objectId":"Lu0sO0hwoO","createdAt":"2020-06-27T09:30:23.293Z","updatedAt":"2020-06-27T09:30:23.293Z","title":"test3","testPF":{"__type":"Pointer","className":"Test2","objectId":"KIZ0y1ZG5j"},"title2":"4","title3":"1","testRL":{"__type":"Relation","className":null,"objects":null}}]
    });

Expected Result:
Got one BHfYX9IibU object

Actual result:
All objects of table Test1 are received.
/[{"className":"Test1","objectId":"BHfYX9IibU","createdAt":"2020-06-27T08:05:28.397Z","updatedAt":"2020-07-04T19:40:25.045Z","title":"test1","testPF":{"__type":"Pointer","className":"Test2","objectId":"r5iLCHPMiS"},"title2":"123","title3":"123","testRL":{"__type":"Relation","className":null,"objects":null}}, {"className":"Test1","objectId":"3nIgR8jZsB","createdAt":"2020-06-27T08:56:40.729Z","updatedAt":"2020-06-27T09:29:50.750Z","title":"test2","testPF":{"__type":"Pointer","className":"Test2","objectId":"0RhHh8OXFB"},"title2":"4","title3":"1","testRL":{"__type":"Relation","className":null,"objects":null}}, {"className":"Test1","objectId":"Lu0sO0hwoO","createdAt":"2020-06-27T09:30:23.293Z","updatedAt":"2020-06-27T09:30:23.293Z","title":"test3","testPF":{"__type":"Pointer","className":"Test2","objectId":"KIZ0y1ZG5j"},"title2":"4","title3":"1","testRL":{"__type":"Relation","className":null,"objects":null}}]

Снимок экрана 2020-07-04 в 23 09 02

iOS-sdk - no this error

@LavTeamProject
Copy link
Author

please, help me

@ZeroNilZero
Copy link

@LavTeamProject any update?

@LavTeamProject
Copy link
Author

@LavTeamProject any update?

No.
Temporary solution:
Using cloud code, I get the necessary records.

Sorry my English

@ZeroNilZero
Copy link

Base on rest api

    QueryBuilder<ParseObject> query = QueryBuilder<User>(User(null, null, null))..whereRelatedTo('relationUserList', '_User', currentUser.objectId);
    var res = await query.query().then((value) {
      print(value.success);
 
      print(value.results.length);
    });

where relationUserList is a relational pointer to _User class And User is custom ParseUser object.

Hope this help.

@LavTeamProject
Copy link
Author

Base on rest api

    QueryBuilder<ParseObject> query = QueryBuilder<User>(User(null, null, null))..whereRelatedTo('relationUserList', '_User', currentUser.objectId);
    var res = await query.query().then((value) {
      print(value.success);
 
      print(value.results.length);
    });

where relationUserList is a relational pointer to _User class And User is custom ParseUser object.

Hope this help.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants