4

I'm using the PHP parse.com SDK to get some data from the server, but whenever I try to do the $query->find() nothing happens.

    $historyDB = new ParseObject('History', $historyId);
    $relation = $historyDB->getRelation("exams");
    $query = $relation->getQuery();
    $findQuery = $query->find();

My $findQuery variable whenever I try to print_r() it shows this error:

    exception 'Parse\ParseException' with message 'missing class name' in 
    C:\wamp\www\parse\php-sdk\src\Parse\ParseClient.php:297 Stack trace: #0 
    C:\wamp\www\parse\php-sdk\src\Parse\ParseQuery.php(346):
    Parse\ParseClient::_request('GET', '/1/classes/?whe...', NULL, NULL, false) #1
    C:\wamp\www\report.php(110): Parse\ParseQuery->find() #2 {main}

I have no idea why, Thanks in advance.

3
  • IMHO it makes no sense to use such a service. You see, it isn't simpler, it is more complicated that way. Also a developer should take himself on the most important part: The data. Commented Oct 12, 2015 at 20:59
  • But what you are going to get?The ParseRelation object just need a $targetClassName to get the result by making a Parse API Call request.So just read the official document. Commented Oct 16, 2015 at 7:04
  • I have actually read the official documente but I have not found anything about setting the $tagetClassName. I have read it from here. Imma definitely write this down now. Commented Oct 16, 2015 at 16:08

1 Answer 1

2
+50

You should set the targetClassName property of the ParseRelation object before you call getQuery(),try to set it by calling setTargetClass().

$historyDB = new ParseObject('History', $historyId);
$relation  = $historyDB->getRelation("exams");
$relation->setTargetClass('targetClassName');
$query     = $relation->getQuery();
$findQuery = $query->find();
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, it worked. Parse really need to update its documentation.

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.