当前位置: 首页>>代码示例>>PHP>>正文


PHP ParseObject::get方法代码示例

本文整理汇总了PHP中Parse\ParseObject::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseObject::get方法的具体用法?PHP ParseObject::get怎么用?PHP ParseObject::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parse\ParseObject的用法示例。


在下文中一共展示了ParseObject::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: price

 public function price($data)
 {
     $cp = new ParseQuery("CarWashPackages");
     $results = $cp->get($data["objectId"]);
     $results->set("isRemoved", true);
     $results->save();
     $newPackage = new ParseObject("CarWashPackages");
     $newPackage->set("detail", $data["detail"]);
     $newPackage->set("isRemoved", false);
     $newPackage->set("title", $data["title"]);
     $newPackage->set("priceNum", (double) $data["priceNum"]);
     $newPackage->set("price", "\$" . $data["priceNum"]);
     $newPackage->set("estTime", (int) $data["estTime"]);
     try {
         $newPackage->save();
         $response = array("Status" => "SUCCESS", "objectId" => $newPackage->getObjectId(), "title" => $newPackage->get("title"), "detail" => $newPackage->get("detail"), "priceNum" => $newPackage->get("priceNum"), "estTime" => $newPackage->get("estTime"), "createdAt" => $newPackage->getCreatedAt());
         return $response;
     } catch (ParseException $ex) {
         $ex_array = array("Status" => "FAILED", "Message" => $ex->getMessage(), "Code" => $ex->getCode());
         return $ex_array;
     }
 }
开发者ID:oscarsmartwave,项目名称:l45fbl45t,代码行数:22,代码来源:Packages_model.php

示例2: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update()
 {
     try {
         ParseClient::initialize(env('PARSE_ID', 'fuck'), env('PARSE_REST', 'fuck'), env('PARSE_MASTER', 'fuck'));
         $local = Input::get('local');
         $condicoesJSON = Input::get('condicoes');
         $condicoes = json_decode($condicoesJSON);
         $encaminhamentoId = Input::get('id');
         $encaminhamentoQuery = new ParseQuery("Encaminhamento");
         $encaminhamento = $encaminhamentoQuery->get($encaminhamentoId);
         $encaminhamento->set('local', $local);
         $encaminhamento->save();
         $condQuery = new ParseQuery("Condicao");
         $condQuery->equalTo('encaminhamento', $encaminhamento);
         $condicoesFromServer = $condQuery->find();
         $condicoesArray = [];
         $destaqueArray = [];
         for ($serverIndex = 0; $serverIndex < count($condicoesFromServer); $serverIndex++) {
             $present = false;
             if (array_key_exists($serverIndex, $condicoesFromServer)) {
                 $keysArray = array_keys($condicoes);
                 for ($localIndex = 0; $localIndex < count($keysArray); $localIndex++) {
                     if (array_key_exists($keysArray[$localIndex], $condicoes)) {
                         if ($condicoes[$keysArray[$localIndex]]->id == $condicoesFromServer[$serverIndex]->getObjectId()) {
                             $present = true;
                             $condicoesFromServer[$serverIndex]->set('ordem', $condicoes[$keysArray[$localIndex]]->ordem);
                             $condicoesFromServer[$serverIndex]->set('destaque', $condicoes[$keysArray[$localIndex]]->destaque);
                             $condicoesFromServer[$serverIndex]->save();
                             $condicoesArray[$condicoes[$keysArray[$localIndex]]->ordem] = $condicoesFromServer[$serverIndex]->getObjectId();
                             $destaqueArray[$condicoes[$keysArray[$localIndex]]->ordem] = $condicoesFromServer[$serverIndex]->get('destaque');
                             unset($condicoes[$keysArray[$localIndex]]);
                         }
                     }
                 }
                 if ($present == false) {
                     $condicoesFromServer[$serverIndex]->destroy();
                 }
             }
         }
         $keysArray = array_keys($condicoes);
         for ($index = 0; $index < count($keysArray); $index++) {
             $condicao = new ParseObject("Condicao");
             $condicao->set('frase', $condicoes[$keysArray[$index]]->frase);
             $condicao->set('ordem', $condicoes[$keysArray[$index]]->ordem);
             $condicao->set('destaque', $condicoes[$keysArray[$index]]->destaque);
             $condicao->set('encaminhamento', $encaminhamento);
             $condicao->save();
             $condicoesArray[$condicoes[$keysArray[$index]]->ordem] = $condicao->getObjectId();
             $destaqueArray[$condicoes[$keysArray[$index]]->ordem] = $condicao->get('destaque');
         }
         Log::info($condicoesArray);
         Log::info($destaqueArray);
         return json_encode(['condicoesArray' => $condicoesArray, 'destaqueArray' => $destaqueArray]);
     } catch (ParseException $error) {
         dd($error);
         return $error;
     }
 }
开发者ID:pietrodegrazia,项目名称:regulaSUSWeb,代码行数:64,代码来源:EncaminhamentoController.php

示例3: testEach

 public function testEach()
 {
     Helper::clearClass("Object");
     $total = 50;
     $count = 25;
     $this->saveObjects($total, function ($i) {
         $obj = new ParseObject("Object");
         $obj->set("x", $i + 1);
         return $obj;
     });
     $query = new ParseQuery("Object");
     $query->lessThanOrEqualTo("x", $count);
     $values = [];
     $query->each(function ($obj) use(&$values) {
         $values[] = $obj->get("x");
     }, 10);
     $valuesLength = count($values);
     $this->assertEquals($count, $valuesLength, 'Did not return correct number of objects.');
     sort($values);
     for ($i = 0; $i < $valuesLength; $i++) {
         $this->assertEquals($i + 1, $values[$i], 'Did not return the correct object.');
     }
 }
开发者ID:rvdavid,项目名称:parse-php-sdk,代码行数:23,代码来源:ParseQueryTest.php

示例4: getABeacon

function getABeacon(ParseObject $object)
{
    $beacon = new stdClass();
    $beacon->objectId = $object->getObjectId();
    $beacon->uuid = $object->get('UUID');
    $beacon->beaconColor = $object->get('beaconColor');
    if (count($object->getRelation("brand")->getQuery()->find()) != 0) {
        $beaconBrand = $object->getRelation("brand")->getQuery()->find();
        $beacon->brand = getABrand($beaconBrand[0]);
    } else {
        $beacon->brand = null;
    }
    $beacon->major = $object->get('major');
    $beacon->minor = $object->get('minor');
    $beacon->name = $object->get('name');
    if ($object->get('region') != null) {
        $beaconRegion = $object->get('region')->fetch();
        $beacon->region = getARegion($beaconRegion);
    } else {
        $beacon->region = null;
    }
    $beacon->type = $object->get('type');
    $beacon->createdAt = $object->getCreatedAt();
    $beacon->upadtedAt = $object->getUpdatedAt();
    return $beacon;
}
开发者ID:azimjs,项目名称:chartswell-admin,代码行数:26,代码来源:global.php

示例5: newEvent

 public function newEvent($gid, Request $request)
 {
     $current_user = ParseUser::getCurrentUser();
     if (!$current_user) {
         return redirect()->route('login');
     }
     Html\Assets::addLink(Html\Link::Css('/vendor/pickadate.js-3.5.6/lib/themes/default.css'));
     Html\Assets::addLink(Html\Link::Css('/vendor/pickadate.js-3.5.6/lib/themes/default.date.css'));
     Html\Assets::addLink(Html\Link::Css(elixir('css/default.css')));
     Html\Assets::addLink(Html\Link::Script('/vendor/pickadate.js-3.5.6/lib/picker.js'));
     Html\Assets::addLink(Html\Link::Script('/vendor/pickadate.js-3.5.6/lib/picker.date.js'));
     Html\Assets::addLink(Html\Link::Script(elixir('scripts/newevent.js')));
     Html\Assets::addMetaTag(Html\Meta::Tag('description', ''));
     $st = $request->input("st");
     $query = new ParseQuery("Groups");
     try {
         $group = $query->get($gid);
         //--save start
         if ($request->getMethod() == "POST") {
             $eventName = $request->input('name');
             $eventDate = $request->input('eventDate');
             $invites = $request->input('invites');
             $update = false;
             $id = $request->input('id');
             if (!empty($id)) {
                 $qry = new ParseQuery('Events');
                 $eventObj = $qry->get($id);
                 $update = true;
             } else {
                 $eventObj = new ParseObject('Events');
             }
             $eventObj->set('name', $eventName);
             if (!empty($eventDate)) {
                 $eventDate = new \DateTime($eventDate);
                 $eventObj->set('date', $eventDate);
             }
             if (empty($eventObj->get('inviteCode'))) {
                 $eventObj->set('inviteCode', $this->generate_random_letters(6));
             }
             if (empty($invites)) {
                 $invites = [];
             }
             $eventObj->setArray('invites', $invites);
             $eventObj->set('user', $current_user);
             $eventObj->set('group', $group);
             try {
                 $eventObj->save();
                 if ($update == false) {
                     $relation = $eventObj->getRelation('members');
                     $relation->add($current_user);
                     $eventObj->save();
                     $grelation = $group->getRelation('events');
                     $grelation->add($eventObj);
                     $group->save();
                     //-- create chat room --//
                     $chatObj = new ParseObject('ChatRoom');
                     $chatObj->set('name', $eventObj->get('name'));
                     $chatObj->set('event', $eventObj);
                     $chatObj->save();
                     $relation = $chatObj->getRelation('members');
                     $relation->add($current_user);
                     $chatObj->save();
                     $eventObj->set('chatRoom', $chatObj);
                     $eventObj->save();
                 }
                 return redirect('/groups');
             } catch (ParseException $ex) {
                 // Execute any logic that should take place if the save fails.
                 // error is a ParseException object with an error code and message.
                 echo 'Failed to create new object, with error message: ' . $ex->getMessage();
             }
         }
         //--save end
         $renderData = $this->getRenderData($request);
         $renderData['user'] = $current_user;
         $renderData['navTitle'] = $group->get('name');
         $renderData['st'] = !empty($st) ? $st : '';
         return view('newevent', $renderData);
     } catch (ParseException $ex) {
         // The object was not retrieved successfully.
         // error is a ParseException with an error code and message.
         echo $ex->getMessage();
     }
 }
开发者ID:samphomsopha,项目名称:codelab,代码行数:84,代码来源:EventController.php

示例6: processGroup

 public function processGroup(Request $request)
 {
     //if logged process otherwise go to login form
     $current_user = ParseUser::getCurrentUser();
     if (!empty($current_user)) {
         //process form
         $lastAction = $request->session()->get('lastAction');
         $groupName = $request->input('groupname') ?: $request->session()->get('newgroup:groupName');
         $invites = $request->input('invites') ?: $request->session()->get('newgroup:invites');
         $public = $request->input('public') ?: $request->session()->get('newgroup:public');
         $reroute = $request->input('reroute');
         $st = $request->input('st');
         $groupId = $request->input('id');
         if (!empty($groupId)) {
             //does this user have permission to edit group
             $qry = new ParseQuery('Groups');
             $groupObj = $qry->get($groupId);
             if ($groupObj->get('public') !== true) {
                 if ($current_user->getObjectId() != $groupObj->get('user')->getObjectId()) {
                     throw new HttpException(401, 'Sorry you don\'t have permission to edit group');
                 }
             }
         } else {
             $groupObj = new ParseObject('Groups');
         }
         $groupObj->set('name', $groupName);
         $groupObj->set('user', $current_user);
         if ($public == 'y') {
             $groupObj->set('public', true);
         } else {
             $groupObj->set('public', false);
         }
         if (empty($invites)) {
             $invites = [];
         }
         $invites = array_keys(array_flip($invites));
         $prevInvites = $groupObj->get('invites') ?: array();
         $diffInvites = array_diff($invites, $prevInvites);
         $groupObj->setArray('invites', $invites);
         if (empty($groupObj->get('inviteCode'))) {
             $groupObj->set('inviteCode', $this->generate_random_letters(6));
         }
         try {
             $groupObj->save();
             $relation = $groupObj->getRelation('members');
             $relation->add($current_user);
             $groupObj->save();
             //send email
             if (!empty($diffInvites)) {
                 $send = new Mail\Send();
                 $send->sendInviteEmail($diffInvites, $current_user, $groupObj->get('inviteCode'), $groupObj->get('name'));
             }
             if ($reroute == 'newevents') {
                 $url = route('newEvent', ['gid' => $groupObj->getObjectId()]) . '?st=' . $st;
                 return redirect($url);
             } else {
                 return redirect('/groups');
             }
         } catch (ParseException $ex) {
             // Execute any logic that should take place if the save fails.
             // error is a ParseException object with an error code and message.
             echo 'Failed to create new object, with error message: ' . $ex->getMessage();
         }
     } else {
         //save form show login
         $request->session()->set('lastAction', 'newgroup');
         $request->session()->set('newgroup:groupName', $request->input('groupname'));
         $request->session()->set('newgroup:invites', $request->input('invites'));
         $request->session()->set('newgroup:public', $request->input('public'));
         return redirect()->route('register');
     }
 }
开发者ID:samphomsopha,项目名称:codelab,代码行数:72,代码来源:GroupController.php


注:本文中的Parse\ParseObject::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。