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


PHP ParseQuery::each方法代码示例

本文整理汇总了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);
 }
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:7,代码来源:Helper.php

示例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) {
     });
 }
开发者ID:rvdavid,项目名称:parse-php-sdk,代码行数:16,代码来源:ParseQueryTest.php

示例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>
开发者ID:CDMayberry,项目名称:PingITWeb,代码行数:31,代码来源:index.php

示例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();
}
开发者ID:CDMayberry,项目名称:PingITWeb,代码行数:31,代码来源:faqPartial.php

示例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.
开发者ID:kevinmthornton,项目名称:local-web-host,代码行数:32,代码来源:parse-test.php

示例6: fetchParseData

 public function fetchParseData()
 {
     $query = new ParseQuery("Task");
     $callBack = array($this, "callBack");
     $query->each($callBack);
 }
开发者ID:joyrocks,项目名称:quiz2php,代码行数:6,代码来源:update-content.php


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