コード例 #1
0
ファイル: Query.php プロジェクト: parziphal/parse
 /**
  * Get the first record that matches the query.
  *
  * @param mixed $selectKeys
  *
  * @return ObjectModel|null
  */
 public function first($selectKeys = null)
 {
     if ($selectKeys) {
         $this->parseQuery->select($selectKeys);
     }
     $data = $this->parseQuery->first($this->useMasterKey);
     if ($data) {
         return $this->createModel($data);
     }
 }
コード例 #2
0
 public function tasks()
 {
     $results = array();
     $object = array();
     $queryCrop = new ParseQuery("Crop");
     $queryCrop->select("cropName");
     $queryCrop->ascending("cropName");
     $object = $queryCrop->find();
     foreach ($object as $value) {
         array_push($results, $value->get('cropName'));
     }
     return view('tasks')->with("results", $results);
 }
コード例 #3
0
 public function maintenance()
 {
     $results = array();
     $queryCropType = new ParseQuery("CropType");
     $queryCropType->select("cropTypeDesc");
     $queryCropType->ascending("cropTypeDesc");
     $cropType = $queryCropType->find();
     $results[0] = array();
     //QUERY ALL CROP TYPE PARSE OBJECTS
     foreach ($cropType as $cType) {
         array_push($results[0], $cType->get('cropTypeDesc'));
     }
     $queryFertilizer = new ParseQuery("Fertilizer");
     $fertilizer = $queryFertilizer->find();
     $results[1] = array();
     //QUERY ALL FERTILIZER TYPE PARSE OBJECTS
     foreach ($fertilizer as $fert) {
         array_push($results[1], $fert->get('fertilizerDesc'));
     }
     return view('maintenance')->with("results", $results);
 }
コード例 #4
0
 public function testSelectKeysQueryArrayArg()
 {
     $obj = ParseObject::create("TestObject");
     $obj->set('foo', 'baz');
     $obj->set('bar', 1);
     $obj->save();
     $query = new ParseQuery("TestObject");
     $query->select(['foo', 'bar']);
     $result = $query->first();
     $this->assertEquals('baz', $result->get('foo'), 'Did not return the correct object.');
     $this->assertEquals(1, $result->get('bar'), 'Did not return the correct object.');
 }
コード例 #5
0
 public function getTimeZone()
 {
     // ParseInstallation.getCurrentInstallation().getString("_Installation");
     $query = new ParseQuery('_Installation', true);
     try {
         $query->select("timeZone");
         $results = $query->find(true);
         $array = array();
         foreach ($results as $result) {
             $array[] = $result->get("timeZone");
         }
         // die('<pre>'.print_r(array_unique($array)));
         return array_unique($array);
     } catch (ParseException $ex) {
         $ex_array = array("Status" => "FAILED", "Message" => $ex->getMessage(), "Code" => $ex->getCode());
         return $ex_array;
     }
     return $results;
 }