I am calling this function in cloud code (it's a pretty simple search function to get around the fact that the php sdk has no "contains") :
Parse.Cloud.define("searchVenues", function(request,response) {
var query = new Parse.Query("Venue");
query.contains("nameLowercase",request.params.term);
query.find({
success: function(results){
response.success(results);
},error: function(){
response.error("Cloud Venue search failed");
}
});
});
I am calling it in a php script as follows:
$search_result = ParseCloud::run("searchVenues", ["term" => $term]);
This function used to work! But now I am getting an error and the following stack trace:
: Uncaught exception 'Exception' with message 'DateTime::__construct() expects parameter 1 to be string, array given' in C:\xampp\htdocs\bcweb\vendor\parse\php-sdk\src\Parse\ParseObject.php:683
Stack trace:
#0 C:\xampp\htdocs\bcweb\vendor\parse\php- sdk\src\Parse\ParseObject.php(683): DateTime->__construct(Array)
#1 C:\xampp\htdocs\bcweb\vendor\parse\php-sdk\src\Parse\ParseObject.php(631): Parse\ParseObject->_mergeMagicFields(Array)
#2 C:\xampp\htdocs\bcweb\vendor\parse\php-sdk\src\Parse\ParseObject.php(599): Parse\ParseObject->mergeFromServer(Array, true)
#3 C:\xampp\htdocs\bcweb\vendor\parse\php-sdk\src\Parse\ParseClient.php(198): Parse\ParseObject->_mergeAfterFetch(Array)
#4 C:\xampp\htdocs\bcweb\vendor\parse\php-sdk\src\Parse\ParseClient.php(209): Parse\ParseClient::_decode(Array)
#5 C:\xampp\htdocs\bcweb\vendor\parse\php-sdk\src\Parse\ParseCloud.php(35): Parse\ParseClient::_decode(Array)
#6 C:\xampp\htdocs\bcweb\lrs\makeCrawl.php(21): Parse\ParseCloud::run('searchVenues', Array)
#7 {main}
I can't imagine what happened to break this? I have a companion function that creates the nameLowercase field on new records, as well. This was there during the happy times when the function worked correctly, so I can't imagine it's existence has anything to do with the error:
Parse.Cloud.beforeSave("Venue", function(request, response) {
if (request.object.get("name")) {
request.object.set("nameLowercase",request.object.get("name").toLowerCase());
}
response.success();
});
There are some single quotes in the strings, but they were there before too. Can anyone who has knowledge of the parse php-sdk explain what may be the problem here? Thanks!