本文整理汇总了PHP中Parse\ParseQuery::matchesQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseQuery::matchesQuery方法的具体用法?PHP ParseQuery::matchesQuery怎么用?PHP ParseQuery::matchesQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse\ParseQuery
的用法示例。
在下文中一共展示了ParseQuery::matchesQuery方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testComplexQueries
public function testComplexQueries()
{
Helper::clearClass("Child");
Helper::clearClass("Parent");
$this->saveObjects(10, function ($i) {
$child = new ParseObject("Child");
$child->set("x", $i);
$parent = new ParseObject("Parent");
$parent->set("y", $i);
$parent->set("child", $child);
return $parent;
});
$subQuery = new ParseQuery("Child");
$subQuery->equalTo("x", 4);
$query1 = new ParseQuery("Parent");
$query1->matchesQuery("child", $subQuery);
$query2 = new ParseQuery("Parent");
$query2->lessThan("y", 2);
$orQuery = ParseQuery::orQueries([$query1, $query2]);
$results = $orQuery->find();
$this->assertEquals(3, count($results), 'Did not return correct number of objects.');
}
示例2: getAttractions
public function getAttractions()
{
$city = new ParseQuery("Cities");
$city->equalTo("city_name", "NewYork");
$query = new ParseQuery("attractions");
$query->matchesQuery("city_attractions", $city);
$currentUser = ParseUser::getCurrentUser();
if ($currentUser) {
$attractions = $query->find();
return view('expertTemplate.displayAttractions')->with('attractions', $attractions)->with('currentUser', $currentUser);
} else {
}
}
示例3: results
private function results()
{
global $wp_query, $post, $wtd_plugin, $wtd_connector;
$res_id = get_post_meta($post->ID, 'res_id', true);
$query = new ParseQuery("resort");
try {
$resort = $query->get($res_id);
// The object was retrieved successfully.
} catch (ParseException $ex) {
error_log($ex->getMessage());
}
$cat_id = get_query_var('wtds');
if (empty($cat_id) && isset($_GET['wtds'])) {
$cat_id = $_GET['wtds'];
}
// get parent category
$query = new ParseQuery('resortParentCategories');
$query->equalTo('cat_class', 'D');
$query->equalTo('resortObjectId', $resort);
$parent_cat = $query->find();
$parent_cat = $parent_cat[0];
// get category if its set
if (!empty($cat_id)) {
$query = new ParseQuery('resortCategory');
try {
$cat = $query->get($cat_id);
} catch (\Parse\ParseException $ex) {
var_dump($ex);
}
}
// parent restriction query
$parent_cat_query = new ParseQuery('resortParentCategories');
$parent_cat_query->equalTo('objectId', $parent_cat->getObjectId());
// subcategory query
$query = new ParseQuery('resortCategory');
$query->matchesQuery('parentResCatObjectId', $parent_cat_query);
$query->greaterThan('diningCnt', 0);
$query->ascending('name');
$categories = $query->find();
?>
<link rel="stylesheet" href="<?php
echo WTD_PLUGIN_URL . 'assets/css/wtd_activities_page.css?wtd_version=' . WTD_VERSION;
?>
" media="screen"/>
<div ng-app="diningApp" ng-controller="diningCtrl">
<div layout="row" layout-sm="column" layout-padding><?php
if ($wtd_plugin['dining_page_type'] == 3) {
?>
<ul layout="column"><?php
for ($i = 0; $i < count($categories); $i++) {
$category = $categories[$i];
$category_url_name = strtolower($parent_cat->get('name'));
$category_url_name = str_replace(' ', '-', $category_url_name);
$category_url_name = str_replace('/', '-', $category_url_name);
$subcategory_url_name = strtolower($category->get('name'));
$subcategory_url_name = str_replace(' ', '-', $subcategory_url_name);
$subcategory_url_name = str_replace(',', '', $subcategory_url_name);
$subcategory_url_name = str_replace('/', '-', $subcategory_url_name);
$url = site_url() . '/' . $post->post_name . '/whattodo/' . $category_url_name . '/' . $parent_cat->getObjectId() . '/' . $subcategory_url_name . '/' . $category->getObjectId() . '/';
?>
<li class="wtd_subcategory_menu_item <?php
echo $category->getObjectId() == $wp_query->query['wtds'] ? 'active' : '';
?>
">
<a href="<?php
echo $url;
?>
"><?php
echo $category->get('name');
?>
</a>
</li><?php
}
?>
</ul><?php
}
if ($wtd_plugin['dining_page_type'] == 2) {
$column_size = 100;
} else {
$column_size = 75;
}
?>
<div layout="row" layout-align="center start" ng-hide="progress == false" layout-padding flex="100">
<md-progress-circular class="md-primary" md-mode="indeterminate"></md-progress-circular>
</div>
<div layout="column" flex="<?php
echo $column_size;
?>
" flex-sm="100" ng-hide="progress == true">
<div layout="row" style="margin-bottom: 5px;">
<a id="parent_<?php
echo $post->ID;
?>
_header" href="<?php
echo get_post_permalink($post->ID);
?>
" class="wtd_pull_left"><?php
echo $post->post_title;
?>
</a><?php
//.........这里部分代码省略.........
示例4: adminCampaignQuery
public function adminCampaignQuery()
{
$user = ParseUser::getCurrentUser();
$outletCheck = $user->get("company");
$companyQuery = new ParseQuery("Companies");
$companyQuery->equalTo("owner", $user);
$outletQuery = new ParseQuery("Outlets");
$outletQuery->matchesQuery("company", $companyQuery);
$campaign_info = [];
$query = new ParseQuery("OutletOffers");
$secResult = $query->matchesQuery("outlet", $outletQuery)->includeKey("outlet")->find();
for ($i = 0; $i < count($secResult); $i++) {
$object = $secResult[$i];
$venueCheck = $object->get("outlet");
$venue = $venueCheck->get("outletName");
$campaign_info[] = ['offerTitle' => $object->get("offerTitle"), 'dateCreated' => $object->getCreatedAt(), 'offerId' => $object->getObjectId(), 'offerStatus' => $object->get("offerStatus"), 'startDate' => $object->get("startDate"), 'expiryDate' => $object->get("expiryDate"), 'venue' => $venue];
}
return $campaign_info;
}
示例5: matchesQuery
/**
* Allow to pass instances of either Query or ParseQuery.
*
* @param string $key
* @param Query|ParseQuery $query
*
* @return $this
*/
public function matchesQuery($key, $query)
{
$this->parseQuery->matchesQuery($key, $this->parseQueryFromQuery($query));
return $this;
}