本文整理汇总了PHP中Parse\ParseQuery::each方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseQuery::each方法的具体用法?PHP ParseQuery::each怎么用?PHP ParseQuery::each使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse\ParseQuery
的用法示例。
在下文中一共展示了ParseQuery::each方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clearClass
public static function clearClass($class)
{
$query = new ParseQuery($class);
$query->each(function (ParseObject $obj) {
$obj->destroy(true);
}, true);
}
示例2: testEachFailsWithLimit
public function testEachFailsWithLimit()
{
$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);
$query->limit(5);
$this->setExpectedException('\\Exception', 'limit');
$query->each(function ($obj) {
});
}
示例3: ParseQuery
</div>
</div>
<div class="col-lg-10 col-lg-offset-2">
<button type="reset" class="btn btn-default">Cancel</button>
<button type="submit" class="btn btn-primary">Add Q&A</button>
</div>
</div>
<div class="half-width">
<div class="form-group text-right">
<div class="col-lg-offset-2 col-lg-10">
<select name="categoryId" class="form-control" id="selectQACat">
<option style="color: grey" value="" disabled selected>* Select A Category</option>
<?php
$query = new ParseQuery("FAQ_Category");
$query->each(function ($category) {
echo "<option value='" . $category->getObjectId() . "'>" . $category->get("Text") . "</option>";
});
?>
</select>
</div>
</div>
</div>
</fieldset>
</form>
<br/>
<div id="faqBox" class="well" style="overflow-y: scroll">
<?php
include "faqPartial.php";
?>
</div>
</div>
示例4: ParseQuery
use Parse\ParseException;
use Parse\ParseAnalytics;
use Parse\ParseFile;
use Parse\ParseCloud;
use Parse\ParseClient;
use Parse\ParseSessionStorage;
$app_id = "kddcodGlyJ6DmGI7FihXt8BsXyOTS09Dgpj8UA49";
$rest_key = "ryU6g6D37JtDqIAnPbTq4SLNmihEIy8kSNPZxlhj";
$master_key = "Fm9X40ewplSIEDTOmYxVdCEN7ge31vgfFwScYr3y";
ParseClient::initialize($app_id, $rest_key, $master_key);
try {
$query = new ParseQuery("FAQ_Category");
$query->each(function ($category) {
$questions = $category->getRelation("Questions");
echo "<h4>" . $category->get("Text") . "</h4>";
echo "<ul>";
$questions->getQuery()->each(function ($qa) {
echo "<li>Question: " . $qa->get("Text") . "</li>";
echo "<li>Answer: " . $qa->get("AnswerText") . "</li>";
echo "<form action='rmvQuestion.php' method='post'>";
echo "<input type='hidden' name='questionId' value='" . $qa->getObjectId() . "'>";
echo "<button type='submit' class='btn btn-sm btn-danger'>Delete</button>";
echo "</form>";
echo "<br/>";
});
echo "</ul>";
});
} catch (ParseException $error) {
// The login failed. Check error to see why.
echo $error->getMessage();
}
示例5: ParseQuery
<?php
ini_set('display_errors', true);
require "autoload.php";
// you get these from parse.com > settings > Keys
$app_id = "Y6jk4OSvcJpg3qX12SlhlJRkPw68nY9NyZ60FyzN";
$rest_key = "iseByHNR2KtqCmjHe5GczjDWmMqJjnScqkVV659K";
$master_key = "mlM9cov7H4jAqkgCAO4DMXOtIZGYBN2PsDqfrqMq";
// must have Parse\ in front of all of these; bad documentation
Parse\ParseClient::initialize($app_id, $rest_key, $master_key);
use Parse\ParseObject;
use Parse\ParseQuery;
// Retrieving
$query = new ParseQuery("Birthday");
$query->each(function ($obj) {
echo $obj->getObjectId();
echo " " . $obj->get("name") . " " . $obj->get("giftIdeas") . "<br> ";
});
// just get a specific record
//try {
// $timsBirthday = $query->get('mmSHXt6GpO');
// //The object was retrieved successfully
// echo "<p>tim's birthday " . $timsBirthday->get("name") . "</p>";
// $timsBirthday->set('name', '');
//
// //$timsBirthday->delete('name');
// $timsBirthday->save();
// //$timsBirthday->destroy();
//
//} catch (ParseException $error) {
// //The object was not retrieved successfully.
// //error is a ParseException with an error code and message.
示例6: fetchParseData
public function fetchParseData()
{
$query = new ParseQuery("Task");
$callBack = array($this, "callBack");
$query->each($callBack);
}