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


PHP ParseQuery::includeKey方法代码示例

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


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

示例1: alerts

 public function alerts($cc = null)
 {
     $current_user = ParseUser::getCurrentUser();
     $query = new ParseQuery("Notifications");
     $query->equalTo("for", $current_user);
     $query->equalTo("read", false);
     $query->includeKey('by');
     $query->includeKey('message');
     try {
         $notifications = $query->find();
         $notes = array();
         foreach ($notifications as $notify) {
             if (!empty($notify->get('message'))) {
                 if ($notify->get('message')->get('chatRoom')->getObjectId() == $cc) {
                     $notify->set("read", true);
                     $notify->save();
                     continue;
                 }
                 $notes[] = ['id' => $notify->getObjectId(), 'for' => $notify->get('for')->getObjectId(), 'from' => ['id' => $notify->get('by')->getObjectId(), 'name' => $notify->get('by')->get('name')], 'message' => $notify->get('message')->get('message')];
             }
         }
         $ret = ['status' => "success", 'data' => ['notifications' => $notes]];
         return response()->json($ret);
     } catch (ParseException $ex) {
         $ret = ['status' => 'fail', 'error' => $ex->getMessage()];
         return response()->json($ret);
     }
 }
开发者ID:samphomsopha,项目名称:codelab,代码行数:28,代码来源:NotificationServiceController.php

示例2: getReports

 public function getReports()
 {
     $query = new ParseQuery("ReportOperator");
     $query->includeKey("user");
     $query->includeKey("operator");
     $results["reports"] = $query->find();
     // for ($i = 0; $i < count($results); $i++) {
     // 	$usernames = $results[$i]->get("username");
     // }
     // die("<pre>".print_r($results, true));
     return $results;
 }
开发者ID:oscarsmartwave,项目名称:l45fbl45t,代码行数:12,代码来源:Reports_model.php

示例3: query

 public function query()
 {
     //iniciamos una consulta para recibir todos los usuarios ausentes de la sede del mentor logueado
     $query = new ParseQuery("Asistencia");
     $query->equalTo('Sede', array("__type" => "Pointer", "className" => "Sedes", "objectId" => $_SESSION['sede']));
     $query->includeKey('Usuario_FK');
     $results = $query->find();
     $listado = array();
     for ($i = 0; $i < count($results); $i++) {
         $object = $results[$i];
         $usuario = $object->get('Usuario_FK');
         $persona = array("ID" => $object->getObjectId(), 'Nombre' => $usuario->get("Nombre"), "Apellido" => $usuario->get("Apellido"), "Presente" => $object->get("Presente"));
         array_push($listado, $persona);
     }
     //definimos una función para ordenar el array con nuestros parámetros
     function custom_sort($a, $b)
     {
         return $a['Nombre'] > $b['Nombre'];
     }
     //ordenamos el array
     usort($listado, "custom_sort");
     //transformamos a json
     $json = json_encode($listado);
     echo $json;
 }
开发者ID:vorenusCoA,项目名称:App_Asistencia,代码行数:25,代码来源:QueryManager.php

示例4: findAllBy

 /**
  * Returns all objects where a given field matches a given value
  * @param string $field
  * @param mixed $value
  * @param array $keyToInclude
  *
  * @return Collection|ParseObject[]
  */
 public function findAllBy($field, $value, $keyToInclude = [])
 {
     $this->query->equalTo($field, $value);
     for ($i = 0; $i < count($keyToInclude); $i++) {
         $this->query->includeKey($keyToInclude[$i]);
     }
     return Collection::make($this->query->find($this->useMasterKey));
 }
开发者ID:khangaikh,项目名称:golocal,代码行数:16,代码来源:AbstractParseRepository.php

示例5: with

 /**
  * Alias for ParseQuery's includeKey.
  *
  * @param string|array $keys
  *
  * @return $this
  */
 public function with($keys)
 {
     if (is_string($keys)) {
         $keys = func_get_args();
     }
     $this->includeKeys = array_merge($this->includeKeys, $keys);
     $this->parseQuery->includeKey($keys);
     return $this;
 }
开发者ID:parziphal,项目名称:parse,代码行数:16,代码来源:Query.php

示例6: getAllRatings

 public function getAllRatings()
 {
     try {
         $_rate = new ParseQuery("OperatorRatings");
         $rate = $_rate->includeKey("user")->includeKey("operator")->find();
         return $rate;
     } catch (ParseException $px) {
         $array_px = array("Message" => $px->getMessage(), "Code" => $px->getCode());
         die('<pre>' . print_r($array_px, true));
         // return $array_px;
     }
 }
开发者ID:oscarsmartwave,项目名称:l45fbl45t,代码行数:12,代码来源:Ratings_model.php

示例7: showChat

 public function showChat($roomId, Request $request)
 {
     $current_user = ParseUser::getCurrentUser();
     if (!$current_user) {
         return redirect()->route('login');
     }
     Html\Assets::addLink(Html\Link::Css(elixir('css/default.css')));
     Html\Assets::addLink(Html\Link::Script(elixir('scripts/chat.js')));
     Html\Assets::addLink(Html\Link::Script('//www.parsecdn.com/js/parse-1.6.7.min.js'));
     Html\Assets::addMetaTag(Html\Meta::Tag('description', ''));
     $query = new ParseQuery("ChatRoom");
     $query->includeKey('event');
     try {
         $chatObj = $query->get($roomId);
         // get events
         $relation = $chatObj->getRelation("messages");
         $query = $relation->getQuery();
         $query->includeKey('user');
         $query->addAscending('createdAt');
         $messages = $query->find();
         $msArr = [];
         foreach ($messages as $messageObj) {
             $relation = $messageObj->getRelation('asset');
             $qry = $relation->getQuery();
             $assets = $qry->find();
             $msArr[] = ['message' => $messageObj, 'assets' => $assets];
         }
         $renderData = $this->getRenderData($request);
         if (count($messages) > 0) {
             $last_message = $messages[count($messages) - 1];
             $renderData['last_timer'] = $last_message->getCreatedAt()->getTimestamp();
             $renderData['lastMsgId'] = !empty($messages[count($messages) - 1]->getObjectId()) ? $messages[count($messages) - 1]->getObjectId() : 0;
         } else {
             $renderData['last_timer'] = 0;
             $renderData['lastMsgId'] = 0;
         }
         $renderData['user'] = $current_user;
         $renderData['chatObj'] = $chatObj;
         $renderData['messages'] = $msArr;
         $renderData['navTitle'] = $chatObj->get('event')->get('name');
         $renderData['user'] = $current_user;
         $renderData['uId'] = $current_user->getObjectId();
         return view('chat', $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,代码行数:49,代码来源:ChatController.php

示例8: toExcel

 public function toExcel()
 {
     $con = new Connect();
     $var = $con->connect_to_db();
     //iniciamos una consulta para recibir todos los usuarios ausentes de la sede del mentor logueado
     $query = new ParseQuery("Asistencia");
     $query->limit(1000);
     $query->includeKey('Usuario_FK');
     $results = $query->find();
     $listado = array();
     for ($i = 0; $i < count($results); $i++) {
         $object = $results[$i];
         $usuario = $object->get('Usuario_FK');
         $sede = $object->get('Sede');
         $persona = array('Nombre' => $usuario->get("Nombre"), "Apellido" => $usuario->get("Apellido"), "Presente" => $object->get("Presente"));
         array_push($listado, $persona);
     }
     //"Fecha" => $object->get("fecha"),
     //definimos una función para ordenar el array con nuestros parámetros
     function custom_sort($a, $b)
     {
         return $a['Nombre'] > $b['Nombre'];
     }
     //ordenamos el array
     usort($listado, "custom_sort");
     //transformamos a json
     //$json = json_encode($listado);
     //echo $json;
     $filename = "asistencia.csv";
     $delimiter = ";";
     header('Content-Type: application/csv');
     header('Content-Disposition: attachment; filename="' . $filename . '";');
     // open the "output" stream
     // see http://www.php.net/manual/en/wrappers.php.php#refsect2-wrappers.php-unknown-unknown-unknown-descriptioq
     $f = fopen('php://output', 'w');
     foreach ($listado as $line) {
         fputcsv($f, $line, $delimiter);
     }
 }
开发者ID:vorenusCoA,项目名称:App_Asistencia,代码行数:39,代码来源:ToExcelManager.php

示例9: testRelationalFields

 public function testRelationalFields()
 {
     Helper::clearClass('Item');
     Helper::clearClass('Container');
     $item = ParseObject::create('Item');
     $item->set('property', 'x');
     $item->save();
     $container = ParseObject::create('Container');
     $container->set('item', $item);
     $container->save();
     $query = new ParseQuery('Container');
     $query->includeKey('item');
     $containerAgain = $query->get($container->getObjectId());
     $itemAgain = $containerAgain->get('item');
     $this->assertEquals('x', $itemAgain->get('property'));
     $query->equalTo('item', $item);
     $results = $query->find();
     $this->assertEquals(1, count($results));
 }
开发者ID:aglo35,项目名称:vr_beta,代码行数:19,代码来源:ParseObjectTest.php

示例10: joinEvent

 public function joinEvent(Request $request)
 {
     $current_user = ParseUser::getCurrentUser();
     Html\Assets::addLink(Html\Link::Css(elixir('css/default.css')));
     Html\Assets::addMetaTag(Html\Meta::Tag('description', ''));
     $renderData = $this->getRenderData($request);
     if ($request->method() == "POST" || $request->session()->get('lastAction') == 'joinevent') {
         if (!empty($current_user)) {
             $code = $request->input('eventCode') ?: $request->session()->get('joinevent:inviteCode');
             $query = new ParseQuery("Events");
             try {
                 $query->equalTo('inviteCode', $code);
                 $query->includeKey('chatRoom');
                 $eventObj = $query->find();
                 if (count($eventObj) > 0) {
                     $eventObj = $eventObj[0];
                     $relation = $eventObj->getRelation('members');
                     $relation->add($current_user);
                     $eventObj->save();
                     //add member to chatroom
                     $chatObj = $eventObj->get('chatRoom');
                     $relation = $chatObj->getRelation('members');
                     $relation->add($current_user);
                     $chatObj->save();
                     //clear last action
                     $request->session()->set('lastAction', '');
                     //redirect to chatroom
                     return redirect()->route('chat', ['roomId' => $chatObj->getObjectId()]);
                 } else {
                     $renderData['errorMsg'] = "Sorry invite code '{$code}' is not valid.'";
                 }
             } catch (ParseException $ex) {
                 // The object was not retrieved successfully.
                 // error is a ParseException with an error code and message.
                 echo $ex->getMessage();
             }
         } else {
             $request->session()->set('lastAction', 'joinevent');
             $request->session()->set('joinevent:inviteCode', $request->input('inviteCode'));
             return redirect()->route('register');
         }
     }
     $renderData['navTitle'] = "Join Event";
     return view('joinevent', $renderData);
 }
开发者ID:samphomsopha,项目名称:codelab,代码行数:45,代码来源:EventController.php

示例11: ParseQuery

<?php

/**
 * Created by PhpStorm.
 * User: jokamjohn
 * Date: 1/13/2016
 * Time: 10:09 PM
 */
use app\Constant;
use Parse\ParseQuery;
require 'vendor/autoload.php';
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $query = new ParseQuery(Constant::$CLIENT_CONTACT_INFO_CLASS_NAME);
    $query->equalTo(Constant::$KEY_OBJECT_ID, $id);
    $query->includeKey(Constant::$KEY_HEALTH_CHECK_INFORMATION);
    $query->includeKey(Constant::$KEY_HEALTH_YES_NO);
    $query->includeKey(Constant::$KEY_HEALTH_STRUCTURED);
    $details = $query->find();
    makeView("person", compact("details"));
}
//for ($i = 0; $i < count($details); $i++) {
//    // This does not require a network access.
//    $record = $details[$i]->get(Constant::$KEY_HEALTH_CHECK_INFORMATION);
//    if($record != null){
//        var_dump($record->get("HasDiseases"));
//    }
//}
开发者ID:jokamjohn,项目名称:Celestini_webapp,代码行数:28,代码来源:person.php

示例12: user_register_report

function user_register_report($first, $last, $pass, $email, $report_id)
{
    $response = new Response();
    $name = $first . "_" . $last;
    $user = new ParseUser();
    $user->set("username", strtolower($name));
    $user->set("email", $email);
    $user->set("password", $pass);
    try {
        $user->signUp();
        $_SESSION['user'] = $user;
        $_SESSION['notification'] = true;
        $query = new ParseQuery("_Session");
        $query->equalTo("user", $user);
        $query->includeKey("user");
        $query->descending("createdAt");
        $query->limit(1);
        $new = $query->find(true);
        $_SESSION['last_date'] = date_format($new[0]->getCreatedAt(), 'Y-m-d\\TH:i:s.u\\Z');
        echo add_user_report($report_id, $user);
    } catch (ParseException $ex) {
        $response->success = false;
        $response->message = 'Error: Failed to register: ' . $error;
        echo json_encode($response);
    }
}
开发者ID:louk,项目名称:One-Nice-Thing,代码行数:26,代码来源:common.php

示例13: wtd_bus_options

function wtd_bus_options($field, $value)
{
    $place = 'business_categories_options';
    $parent_filters = get_option('wtd_excluded_parent_cats');
    if (!empty($parent_filters)) {
        $enabled_parent_cat_filters = json_decode($parent_filters);
    }
    $excluded_cats = get_option('wtd_excluded_cats');
    ?>
	<div ng-controller="categoryExclusion"><?php 
    $query = new ParseQuery('wp_site');
    $query->equalTo('token', get_option('wtd_api_token'));
    $site_results = $query->find();
    $site = $site_results[0];
    $relation = $site->getRelation('resortRelation', 'resort');
    $resorts = $relation->getQuery()->find();
    $query = new ParseQuery('resortParentCategories');
    $query->equalTo('deleted', false);
    $query->containedIn('resortObjectId', $resorts);
    $query->includeKey('resortObjectId');
    $results = $query->find();
    ?>
		<script type="text/javascript"><?php 
    if (empty($enabled_parent_cat_filters)) {
        ?>
				var enabled_parent_filters = null;
				var excluded_cats = null;<?php 
    } else {
        ?>
				var enabled_parent_filters = JSON.parse('<?php 
        echo empty($parent_filters) ? '{"result":true}' : $parent_filters;
        ?>
');<?php 
        if (empty($excluded_cats)) {
            ?>
					var excluded_cats = null;<?php 
        } else {
            ?>
					var excluded_cats = JSON.parse('<?php 
            echo $excluded_cats;
            ?>
');<?php 
        }
    }
    ?>

			jQuery(document).ready(function(){
				if(enabled_parent_filters!= null && enabled_parent_filters!= undefined ){
					for(var i = 0; i < enabled_parent_filters.length; i++){
						var parent_id = enabled_parent_filters[i];
						Parse.Cloud.run('get_subcategory_list_v2', {
							parent_id: parent_id,
							token: token
						}, {
							success: function(result){
								showSubcategoryList(parent_id, result);
							},
							error: function(error){
								console.log(error);
							}
						});
					}
				}
			});
		</script>
		<div data-place="<?php 
    echo $place;
    ?>
"><?php 
    for ($i = 0; $i < count($results); $i++) {
        $cat = $results[$i];
        $cat_id = $cat->getObjectId();
        $cat_enable = '';
        $cat_disable = 'selected';
        if (!empty($enabled_parent_cat_filters)) {
            if (in_array($cat->getObjectId(), $enabled_parent_cat_filters)) {
                $cat_enable = 'selected';
                $cat_disable = '';
            }
        }
        ?>
				<div id="<?php 
        echo $place;
        ?>
_parent_<?php 
        echo $cat_id;
        ?>
">
					<fieldset class="redux-field-container redux-field redux-container-switch" data-id="category-<?php 
        echo $cat->getObjectId();
        ?>
" data-type="switch">
						<div class="switch-options">
							<label id="<?php 
        echo $cat_id;
        ?>
_filter_enabled" class="cb-enable <?php 
        echo $cat_enable;
        ?>
" ng-click="getSubcategories('<?php 
//.........这里部分代码省略.........
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:101,代码来源:wtd_redux_config.class.php

示例14: getComments

 public function getComments()
 {
     $query = new ParseQuery("Messages");
     $query->equalTo("animal_Id", $this);
     $query->includeKey("id_user");
     $comments = $query->find();
     $this->_comments = [];
     foreach ($comments as $comment) {
         $user = $comment->get('id_user');
         $data = ["user_photo" => '', "user_name" => $user->get('name') . " " . $user->get('lastname'), "message" => $comment->get("message"), "likes" => count($comment->get("likesRelation"))];
         if ($user->get('photoFile') != null) {
             $data["user_photo"] = $user->get('photoFile')->getURL();
         } else {
             if ($user->get('photo') != null) {
                 $data['user_photo'] = $user->get('photo');
             } else {
                 $data['user_photo'] = 'http://files.parsetfss.com/a82729a1-e6e9-43f0-acae-a060f3153c6d/tfss-3d88ecd0-d988-4ab3-a297-cf44a2682864-perfil3.jpg';
             }
         }
         array_push($this->_comments, $data);
     }
     return $this->_comments;
 }
开发者ID:GerardoDRM,项目名称:BondzuWebApp,代码行数:23,代码来源:Animal.php

示例15: testIncludeMultipleKeys

 public function testIncludeMultipleKeys()
 {
     Helper::clearClass("Foo");
     Helper::clearClass("Bar");
     Helper::clearClass("Parent");
     $foo = ParseObject::create('Foo');
     $foo->set('rev', 'oof');
     $foo->save();
     $bar = ParseObject::create('Bar');
     $bar->set('rev', 'rab');
     $bar->save();
     $parent = ParseObject::create('Parent');
     $parent->set('foofoo', $foo);
     $parent->set('barbar', $bar);
     $parent->save();
     $query = new ParseQuery('Parent');
     $query->includeKey(['foofoo', 'barbar']);
     $result = $query->first();
     $this->assertEquals('oof', $result->get('foofoo')->get('rev'), 'Object should be fetched');
     $this->assertEquals('rab', $result->get('barbar')->get('rev'), 'Object should be fetched');
 }
开发者ID:rvdavid,项目名称:parse-php-sdk,代码行数:21,代码来源:ParseQueryTest.php


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