本文整理汇总了PHP中Parse\ParseObject::getObjectId方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseObject::getObjectId方法的具体用法?PHP ParseObject::getObjectId怎么用?PHP ParseObject::getObjectId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse\ParseObject
的用法示例。
在下文中一共展示了ParseObject::getObjectId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'));
$condicoesJSON = Input::get('condicoes');
$condicoes = json_decode($condicoesJSON);
$protocoloId = Input::get('id');
$protocoloQuery = new ParseQuery("Protocolo");
$protocolo = $protocoloQuery->get($protocoloId);
$condQuery = new ParseQuery("DescritivoMinimo");
$condQuery->equalTo('protocolo', $protocolo);
$condicoesFromServer = $condQuery->find();
$condicoesArray = [];
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]->save();
$condicoesArray[$condicoes[$keysArray[$localIndex]]->ordem] = $condicoesFromServer[$serverIndex]->getObjectId();
unset($condicoes[$keysArray[$localIndex]]);
}
}
}
if ($present == false) {
$condicoesFromServer[$serverIndex]->destroy();
}
}
}
$keysArray = array_keys($condicoes);
for ($index = 0; $index < count($keysArray); $index++) {
$condicao = new ParseObject("DescritivoMinimo");
$condicao->set('frase', $condicoes[$keysArray[$index]]->frase);
$condicao->set('ordem', $condicoes[$keysArray[$index]]->ordem);
$condicao->set('protocolo', $protocolo);
$condicao->save();
$condicoesArray[$condicoes[$keysArray[$index]]->ordem] = $condicao->getObjectId();
}
return json_encode($condicoesArray);
} catch (ParseException $error) {
dd($error);
return $error;
}
}
示例2: update
public function update($obj)
{
if (empty($obj)) {
die("No hay asistentes para Actualizar.");
}
$con = new Connect();
$var = $con->connect_to_db();
$date = new DateTime();
$resultado = new ParseObject("Asistencia", $obj["IdUsuario"]);
$resultado->set("Fecha", $date);
$resultado->set("Presente", $obj["Presente"]);
try {
$resultado->save();
echo 'El objeto fue actualizado: ' . $resultado->getObjectId();
} catch (ParseException $ex) {
echo 'Fallo al actualizar, mensaje de error: ' . $ex->getMessage();
}
}
示例3: add
function add()
{
// validators
$this->form_validation->set_error_delimiters($this->config->item('error_delimeter_left'), $this->config->item('error_delimeter_right'));
$this->form_validation->set_rules('user_id', lang('reservations input user_id'), 'trim');
$this->form_validation->set_rules('team_id', lang('reservations input team_id'), 'trim');
$this->form_validation->set_rules('match_data[date]', lang('reservations input date'), 'required|trim');
$this->form_validation->set_rules('match_data[time]', lang('reservations input time'), 'required|trim');
$this->form_validation->set_rules('match_data[duration]', lang('reservations input duration'), 'required|trim|numeric');
if ($this->form_validation->run() == true) {
$data = $this->input->post();
// save the new user
$reservation = new ParseObject("Reservation");
$relationOwner = $reservation->getRelation("userId");
$queryOwner = ParseUser::query();
$owner = $queryOwner->get("btPTAhtpvo");
$relationOwner->add($owner);
$relationStatus = $reservation->getRelation("status");
$queryStatus = new ParseQuery("ReservationStatus");
$status = $queryStatus->get("KIzDQVJrAV");
$relationStatus->add($status);
$reservation->setAssociativeArray("reservationData", $data['match_data']);
try {
$reservation->save();
$this->session->set_flashdata('message', 'New object created with objectId: ' . $reservation->getObjectId());
redirect($this->_redirect_url);
} 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.
$this->session->set_flashdata('error', 'Failed to create new object, with error message: ' . $ex->getMessage());
}
// return to list and display message
}
// setup page header data
// setup page header data
$this->set_title(sprintf(lang('reservations title reservations'), $this->settings->site_name));
$this->set_subtitle(lang('reservations subtitle add_reservation'));
$data = $this->includes;
// set content data
$content_data = array('cancel_url' => $this->_redirect_url, 'user' => null, 'password_required' => true);
// load views
$data['content'] = $this->load->view('reservations/form', $content_data, true);
$this->load->view($this->template, $data);
}
示例4: 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;
}
}
示例5: add
function add()
{
$resto = new ParseObject("Restaurant");
$myIsFast = $this->_isFast == "true" ? true : false;
$resto->set("address", $this->_address);
$resto->set("city", $this->_city);
$resto->set("coord", $this->_coord);
$resto->set("description", $this->_description);
$resto->set("fast", $myIsFast);
$resto->set("name", $this->_nom);
$resto->set("postal", $this->_postal);
$resto->set("website", $this->_website);
$resto->set("validated", $this->_isValidated);
try {
$resto->save();
return $resto->getObjectId();
} 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();
}
}
示例6: add
function add()
{
echo $this->_nom;
$coordonees = new ParseGeoPoint(floatval($this->_latitude), floatval($this->_longitude));
$resto = new ParseObject("Restaurant");
$isFast = $this->_isFast == "true" ? true : false;
$resto->set("address", $this->_address);
$resto->set("city", $this->_city);
$resto->set("coord", $this->coordonees);
$resto->set("description", $this->_description);
$resto->set("fast", $this->{$isFast});
$resto->set("name", $this->_nom);
$resto->set("postal", $this->_postal);
$resto->set("website", $this->_website);
$resto->set("validated", $this->_isValidated);
try {
$resto->save();
echo 'New object created with objectId: ' . $resto->getObjectId();
} 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();
}
}
示例7: upload
public function upload(Request $request)
{
if (isset($_FILES['image'])) {
// save file to Parse
try {
$fname = str_replace(' ', '', $_FILES['image']['name']);
$file = ParseFile::createFromData(file_get_contents($_FILES['image']['tmp_name']), $fname);
$file->save();
// save something to class TestObject
$asset = new ParseObject("Assets");
// add the file we saved above
$asset->set("file", $file);
$asset->save();
$ret = ['status' => 'success', 'data' => ['asset' => ['id' => $asset->getObjectId()], 'file' => ['url' => $file->getUrl()]]];
return response()->json($ret);
} catch (ParseException $ex) {
$ret = ['status' => 'fail', 'error' => $ex->getMessage()];
return response()->json($ret);
}
} else {
$ret = ['status' => 'fail', 'error' => 'no file selected'];
return response()->json($ret);
}
}
示例8: 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;
}
}
示例9: ParseObject
$response->speakers = $spkArray;
$response->avatar = $imgArray;
$response->date = $dateArray;
echo json_encode($response);
} else {
$chat = new ParseObject("Chat");
$users = array();
array_push($users, $host->getObjectId());
array_push($users, $user->getObjectId());
$chat->setArray('users', $users);
try {
$chat->save();
$response = new Response();
$response->success = true;
$response->type = 2;
$response->chat = $chat->getObjectId();
$response->user = $user->getObjectId();
echo json_encode($response);
} catch (ParseException $ex) {
$response->success = false;
$response->message = 'Error: Failed to chat: ' . $ex;
echo json_encode($response);
}
}
}
if ($func == 'get_user_all') {
$query = new ParseQuery("_User");
$query->equalTo('status', 1);
$users = $query->find();
$ids = array();
$names = array();
示例10: mysqli
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
$chatData = new ParseObject("ChatData");
if ($user_id_1 !== NULL && $user_id_2 !== NULL) {
//insert
$like_insert_sql = "INSERT INTO likes (user_id_1,user_id_2) VALUES ('{$user_id_1}','{$user_id_2}');";
if ($conn->query($like_insert_sql) == true) {
$json_response["success"] = true;
//checking for a new match
$sql = "SELECT * FROM likes WHERE user_id_1 = '{$user_id_2}' AND user_id_2 = '{$user_id_1}';";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
try {
$chatData->setArray("messages", array());
$chatData->save();
$chat_id = $chatData->getObjectId();
$match_sql_1 = "INSERT INTO matches (user_id_1,user_id_2,chat_id) VALUES ('{$user_id_1}','{$user_id_2}','{$chat_id}');";
$match_sql_2 = "INSERT INTO matches (user_id_1,user_id_2,chat_id) VALUES ('{$user_id_2}','{$user_id_1}','{$chat_id}');";
$conn->query($match_sql_1);
$conn->query($match_sql_2);
} 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 {
$json_response["success"] = false;
echo mysql_error();
}
示例11: ParseObject
ParseClient::initialize('jVbb8uYocFpOhxTnZtY8DqvVmiEVgWQyU71K24p0', 'ilsN27z74t3N7FAxGVNk7KNDZPwprFbMqWGlQQk8', 'XWMlF7HBGQgblHHN242MfBMjuZJzxH17zzkvo0SB');
?>
</head>
<body>
<?php
if (isset($_POST['insertData'])) {
$question = $_POST['question'];
$answer = $_POST['answer'];
$QA = new ParseObject("QuestionAnswer");
$QA->set($QUESTION, $question);
$QA->set($ANSWER, $answer);
$QA->set($IS_ANSWERED, TRUE);
try {
$QA->save();
$_SESSION['qid'] = $QA->getObjectId();
//echo 'qid '.$_SESSION['qid'];
die("<script>location.href = 'addNameInfo.php'</script>");
} catch (Parse\ParseException $exc) {
echo $exc->getTraceAsString() . '. Please try again';
}
}
?>
<div class="container" style="margin-top: 200px;">
<form action="index.php" method="post">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Data entry form for Kajol vai and his team</h3>
</div>
<div class="panel-body">
示例12: sendmail
$result = true;
} 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 'Error: Failed to create new object, with error message: ' . $ex->getMessage();
return;
}
class Response
{
}
if ($result) {
$response = new Response();
$response->success = true;
$response->message = "Your nice thing is added";
$response->user = $res_user;
$response->data = $nice_thing->getObjectId();
$_SESSION['id'] = $nice_thing->getObjectId();
echo json_encode($response);
} else {
echo "Error: User please select valid username";
}
function sendmail($user, $message)
{
$body = $message;
date_default_timezone_set('Etc/UTC');
$mail = new PHPMailer();
$mail->isSMTP();
// $mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->Host = '1nicethingnet.domain.com';
$mail->Port = 587;
示例13: arrayize
$results = $query->find();
$result = $results[0];
//get garden sensors list
$sensors = $result->get("pName");
echo "<br>We are expecting these sensors: " . $sensors;
/* assign sensor values based on above sensor list
for ($i = 0; $i < count($sensors); $i++) {
$object = $sensors[$i];
echo $object;
}
*/
//assemble sensor array
function arrayize($input)
{
return array_map('intval', array_filter(explode(",", $input), 'is_numeric'));
}
//$currentReadings = preg_split("\"",
$reading = new ParseObject("Reading");
$reading->set("gardenID", $result);
$reading->setArray("readings", [arrayize($airTemp), arrayize($hum), arrayize($waterTemp), arrayize($sun), arrayize($wet), arrayize($waterPH)]);
try {
$reading->save();
echo '<br>New reading created with objectId: ' . $reading->getObjectId() . '<br>';
} 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();
}
示例14: ParseObject
<?php
require 'vendor/autoload.php';
use Parse\ParseClient;
session_start();
ParseClient::initialize('6OsMY7JbzoLcCpP1UBgMUJdc4Ol68kDskzq8b3aw', 'B7llkQxaYdCqUlFENwTCEeavarSvQp4It25a0kpH', '7QwWggaRtzFsNniqlgrXwtRqkLaXmW2BzOJMv6O9');
use Parse\ParseQuery;
use Parse\ParseObject;
use Parse\ParseUser;
use Parse\ParseException;
$currentUser = ParseUser::getCurrentUser();
$survey = new ParseObject("surveys");
$survey->set("userid", $currentUser->getObjectId());
$survey->set("logo_url", $currentUser->get("logo_url"));
$survey->save();
$_SESSION['survey'] = $survey->getObjectId();
include "assets/templates/header.php";
?>
<link href="assets/css/dropzone.css" type="text/css" rel="stylesheet" />
<script src="assets/js/dropzone.js"></script>
<br>
<div id="login-overlay" class="modal-dialog">
<div class="well">
<h3 class="title text-center">Upload your images here! </h3>
<div class="form-group">
<form action="upload.php" method="post" class="dropzone" id="my-awesome-dropzone">
</form>
<span class="help-block"></span>
示例15: createProduct
function createProduct($prod)
{
echo "<br />\n";
echo 'Start creating product';
$rakuten_product = new ParseObject("Rakuten_Product");
// Set values
$rakuten_product->set("sku", (string) $prod->sku);
$rakuten_product->set("title", (string) $prod->name);
$rakuten_product->set("imageUrl", (string) $prod->productImage);
$rakuten_product->set("info", (string) $prod->long_description);
$rakuten_product->set("affiliateUrl", (string) $prod->productUrl);
$rakuten_product->set("price", floatval($prod->final_price));
$rakuten_product->set("MSRP", floatval($prod->retail));
try {
echo "<br />\n";
echo "Start Saving product. <br />\n";
$rakuten_product->save();
echo "End saving.";
echo 'New object created with objectId: ' . $rakuten_product->getObjectId();
} catch (Exception $ex) {
echo "<br />\n";
echo "Error saving";
echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}
// Save:
$newId = $rakuten_product->getObjectId();
//save to product images
}