本文整理汇总了PHP中Parse\ParseQuery::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseQuery::get方法的具体用法?PHP ParseQuery::get怎么用?PHP ParseQuery::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse\ParseQuery
的用法示例。
在下文中一共展示了ParseQuery::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find
/**
* @param $id
* @param array $columns
* @param array $keyToInclude
*
* @return ParseObject
*/
public function find($id, $columns = ['*'], $keyToInclude = [])
{
for ($i = 0; $i < count($keyToInclude); $i++) {
$this->query->includeKey($keyToInclude[$i]);
}
return $this->query->get($id, $this->useMasterKey);
}
示例2: dtestParseBytesFromBase64Data
public function dtestParseBytesFromBase64Data()
{
$obj = ParseObject::create("TestObject");
$bytes = ParseBytes::createFromBase64Data("R3JhbnRsYW5k");
$obj->set("byteColumn", $bytes);
$obj->save();
$query = new ParseQuery("TestObject");
$objAgain = $query->get($obj->getObjectId());
$this->assertEquals("Grantland", $objAgain->get("byteColumn"));
}
示例3: retrieveById
/**
* Retrieve a user by their unique identifier.
*
* @param mixed $identifier
*
* @return \Illuminate\Contracts\Auth\Authenticatable|\LaraParse\Subclasses\User|null
*/
public function retrieveById($identifier)
{
// check current user exist
$currentUser = ParseUser::getCurrentUser();
if ($currentUser->getObjectId() == $identifier) {
return $currentUser;
}
$query = new ParseQuery('_User');
return $query->get($identifier, true);
}
示例4: getCarsOfUsers
public function getCarsOfUsers($userObjectId)
{
$_user = new ParseQuery("_User");
$_user->get($userObjectId);
$user = $_user->find();
$_car = new ParseQuery("Car");
$_car->equalTo("owner", $user[0]);
$cars = $_car->find();
return $cars;
}
示例5: testParseBytesFromBase64Data
public function testParseBytesFromBase64Data()
{
$obj = ParseObject::create('BytesObject');
$bytes = ParseBytes::createFromBase64Data('R3JhbnRsYW5k');
$obj->set('byteColumn', $bytes);
$obj->save();
$query = new ParseQuery('BytesObject');
$objAgain = $query->get($obj->getObjectId());
$this->assertEquals('Grantland', $objAgain->get('byteColumn'));
}
示例6: store
public function store(ValidateAddExpert $request)
{
$expert = new ParseObject("experts");
$expert->set("name", $request->get('name'));
$expert->set("email", $request->get('email'));
$expert->set("password", bcrypt($request->get('password')));
$cityID = $request->get('city');
$c = new ParseQuery("Cities");
$city = $c->get($cityID);
$expert->set("city", $city);
$expert->save();
return \Redirect::route('addExpert')->with('message', 'Expert has been created');
}
示例7: retrieveById
/**
* Retrieve a user by their unique identifier.
*
* @param mixed $identifier
*
* @return \Illuminate\Contracts\Auth\Authenticatable|\LaraParse\Subclasses\User|null
*/
public function retrieveById($identifier)
{
$query = new ParseQuery('_User');
try {
return $query->get($identifier, true);
} catch (ParseException $pex) {
// Only return null if it's the object not found exception
if ($pex->getCode() == self::PEX_OBJECT_NOT_FOUND) {
return null;
} else {
throw $pex;
}
}
}
示例8: deleteAction
/**
* Finds the item by id and removes it. Redirects to the app (PRG) and uses the flash message to pass on any errors.
*/
public function deleteAction()
{
if (!$this->request instanceof \Zend\Http\Request or !$this->request->isPost()) {
return;
//nothing to do
}
$query = new ParseQuery(self::PARSE_CLASS);
try {
$item = $query->get($this->request->getPost('id'));
$item->destroy();
} catch (ParseException $e) {
$this->flashMessenger()->addErrorMessage($e->getMessage());
}
$this->redirect()->toRoute('app');
}
示例9: fetchParseUser
private function fetchParseUser($user_id)
{
$query = new ParseQuery("UserObject");
$parseUser = "UserObjectDoesNotExist";
try {
$parseUser = $query->get($user_id);
return $parseUser;
// The object was retrieved successfully.
} catch (ParseException $ex) {
// The object was not retrieved successfully.
// error is a ParseException with an error code and message.
echo 'Kõik on katki!';
}
return $parseUser;
}
示例10: 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;
}
}
示例11: get
public function get($className, $objectId)
{
$query = new ParseQuery($className);
try {
$parseObject = $query->get($objectId);
$parseObject->status = 1;
return $parseObject;
} catch (ParseException $e) {
$this->lastError = $e;
$errorObject = new stdClass();
$errorObject->status = 0;
$errorObject->code = $e->getCode();
$errorObject->message = $e->getMessage();
return $errorObject;
}
}
示例12: showHome
public function showHome(Request $request)
{
$current_user = ParseUser::getCurrentUser();
if (!$current_user) {
return redirect()->route('login');
}
$query = ParseUser::query();
$current_user = $query->get($current_user->getObjectId());
Html\Assets::addLink(Html\Link::Css(elixir('css/default.css')));
Html\Assets::addMetaTag(Html\Meta::Tag('description', ''));
$query = new ParseQuery("ChatRoom");
$query->equalTo('members', $current_user);
try {
$chatRooms = $query->find();
$query = new ParseQuery("Messages");
$query->containedIn("chatRoom", $chatRooms);
$query->descending('createdAt');
$query->includeKey('chatRoom');
$query->includeKey('user');
$query->limit(20);
$messages = $query->find();
$data = [];
foreach ($messages as $message) {
$chatRoom = $message->get('chatRoom');
$event = $chatRoom->get('event');
$evQuery = new ParseQuery('Events');
$evQuery->includeKey('group');
$event = $evQuery->get($event->getObjectId());
$group = $event->get('group');
$relation = $message->getRelation("asset");
$aqry = $relation->getQuery();
$assets = $aqry->find();
$temp = ['group' => $group, 'event' => $event, 'chatRoom' => $chatRoom, 'message' => ['msg' => $message, 'assets' => $assets], 'user' => $message->get('user')];
$data[] = $temp;
}
} catch (ParseException $ex) {
// The object was not retrieved successfully.
// error is a ParseException with an error code and message.
echo $ex->getMessage();
}
$renderData = $this->getRenderData($request);
$renderData['user'] = $current_user;
$renderData['activeBarTab'] = "dashboard";
$renderData['data'] = $data;
return view('home', $renderData);
}
示例13: save
public function save(Request $request)
{
$current_user = ParseUser::getCurrentUser();
$name = $request->input('name');
$assetId = $request->input('assetId');
$current_user->set('name', $name);
try {
if (!empty($assetId)) {
$query = new ParseQuery("Assets");
$asset = $query->get($assetId);
if (!empty($asset)) {
$current_user->set('image', $asset->get('file'));
}
}
$current_user->save();
} catch (\Exception $ex) {
echo 'Failed to create new object, with error message: ' . $ex->getMessage();
}
return redirect()->route('profile');
}
示例14: showUploader
public function showUploader($roomId, Request $request)
{
$current_user = ParseUser::getCurrentUser();
if (!$current_user) {
return redirect()->route('login');
}
$message = $request->input('msg');
Html\Assets::addLink(Html\Link::Css('/vendor/dropzone/dropzone.css'));
Html\Assets::addLink(Html\Link::Css(elixir('css/default.css')));
Html\Assets::addLink(Html\Link::Script('//www.parsecdn.com/js/parse-1.6.7.min.js'));
Html\Assets::addLink(Html\Link::Script('/vendor/dropzone/dropzone.js'));
Html\Assets::addLink(Html\Link::Script(elixir('scripts/chatUploader.js')));
Html\Assets::addMetaTag(Html\Meta::Tag('description', ''));
$query = new ParseQuery("ChatRoom");
$chatObj = $query->get($roomId);
$renderData = $this->getRenderData($request);
$renderData['user'] = $current_user;
$renderData['chatObj'] = $chatObj;
$renderData['message'] = $message;
return view('chatUploader', $renderData);
}
示例15: retrieveById
/**
* Retrieve a user by their unique identifier.
*
* @param mixed $identifier
*
* @return \Illuminate\Contracts\Auth\Authenticatable|\LaraParse\Subclasses\User|null
*/
public function retrieveById($identifier)
{
$query = new ParseQuery('_User');
return $query->get($identifier, true);
}