Пример #1
1
function getSeekers()
{
    $query = new ParseQuery("BagTransaction");
    $query->doesNotExist("status");
    $results = $query->find();
    $users = array();
    //convert BagTransactions to Users
    foreach ($results as $result) {
        $user = $result->get("borrower");
        $user->fetch();
        $users[] = $user;
    }
    return $users;
}
Пример #2
0
 public function testDoesNotExistRelation()
 {
     Helper::clearClass("Item");
     $this->saveObjects(9, function ($i) {
         $obj = ParseObject::create("TestObject");
         if ($i & 1) {
             $obj->set('y', $i);
         } else {
             $item = ParseObject::create("Item");
             $item->set('x', $i);
             $obj->set('x', $i);
         }
         return $obj;
     });
     $query = new ParseQuery("TestObject");
     $query->doesNotExist('x');
     $results = $query->find();
     $this->assertEquals(4, count($results), 'Did not return correct number of objects.');
 }
                $response->errorDescription = "master key empty.";
            }
        }
    }
    header('Content-type: application/json');
    echo stripslashes(json_encode($response));
} else {
    ParseClient::initialize(PARSE_APPLICATION_ID, PARSE_REST_API_KEY, PARSE_MASTER_KEY);
    $subFolderPath = 'images';
    // SubFolder検出
    $queryStoreSubFolder = new ParseQuery(IDF_STORE_SUB_FOLDER_CLASS_NAME);
    $s_folderSelector = htmlspecialchars($_POST['selector'], ENT_QUOTES);
    if (strlen($s_folderSelector) > 0) {
        $queryStoreSubFolder->equalTo('selector', $s_folderSelector);
    } else {
        $queryStoreSubFolder->doesNotExist('selector');
    }
    // サブフォルダを検索
    $resultsStoreSubFolder = $queryStoreSubFolder->find();
    // ランダムで取得
    if (count($resultsStoreSubFolder)) {
        $subfolderObject = $resultsStoreSubFolder[array_rand($resultsStoreSubFolder, 1)];
        $subFolderPath = $subfolderObject->get('path');
        $dir = getcwd() . '/' . $subFolderPath;
        if (!is_dir($dir)) {
            if (!mkdir($dir)) {
                throw new RuntimeException('Failed to create directory: ' . $dir);
            }
            chmod($dir, 0777);
        }
    }
Пример #4
0
 public function whereNotExists($key)
 {
     $this->parseQuery->doesNotExist($key);
     return $this;
 }
Пример #5
0
 function getOpenBikesWithinDistance($latitude, $longitude, $radius)
 {
     $point = new ParseGeoPoint($latitude, $longitude);
     $query = new ParseQuery("Bikes");
     $query->includeKey("currentUser");
     $query->doesNotExist("currentUser");
     $query->withinMiles("lastLocation", $point, $radius);
     $query->limit(1000);
     $results = $query->find();
     $count = count($results);
     $listOfBikes = array();
     for ($i = 0; $i < $count; $i++) {
         $bike = $results[$i];
         $ID = $bike->getObjectId();
         $point = $bike->get("lastLocation");
         $lat = $point->getLatitude();
         $long = $point->getLongitude();
         $object = new stdClass();
         $object->bikeID = $ID;
         $object->latitude = $lat;
         $object->longitude = $long;
         array_push($listOfBikes, $object);
     }
     return $listOfBikes;
 }