本文整理汇总了PHP中Parse\ParseQuery::count方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseQuery::count方法的具体用法?PHP ParseQuery::count怎么用?PHP ParseQuery::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse\ParseQuery
的用法示例。
在下文中一共展示了ParseQuery::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: auth
/**
* Handles authentication via estonian id-card. Saves data into model User.
*/
public function auth()
{
$ePerson = getEPerson();
if (!$ePerson) {
// TODO: Better handling
$this->user->string = "ID kaardiga autentimine ebaõnnestus!";
} else {
$this->user->lastName = $ePerson[0];
$this->user->firstName = $ePerson[1];
$this->user->nationalID = $ePerson[2];
$this->user->string = "ID kaardiga autentimine õnnestus edukalt!";
// Check if UserObject already exists
// TODO: Put following code into separate function
$query = new ParseQuery("UserObject");
$query->equalTo("nationalID", $this->user->nationalID);
$count = $query->count();
$parseUser = $query->first();
if ($count == 1 && $parseUser->get('nationalID') == $this->user->nationalID) {
$this->user->parseMessage = $parseUser->getObjectId();
} else {
$this->saveUserData($this->user, $this->user->lastName, $this->user->firstName, $this->user->nationalID);
}
// Starts user session
$this->begin_session();
// $this->signUp($this->user, $this->user->lastName, $this->user->firstName, $this->user->nationalID);
}
}
示例2: doQuery
public function doQuery()
{
$currentUser = ParseUser::getCurrentUser();
$companyQuery = new ParseQuery("Companies");
$companyQuery->equalTo("owner", $currentUser);
$companyQuery->ascending("name");
$compResults = $companyQuery->first();
$objectId = $compResults->getObjectId();
$company = new ParseObject("Companies", $objectId);
$outletQuery = new ParseQuery("Outlets");
$outletQuery->equalTo("company", $company);
$results = $outletQuery->find();
$outletInfo = [];
for ($i = 0; $i < count($results); $i++) {
$object = $results[$i];
$outlet = new ParseObject("Outlets", $object->getObjectId());
$offerQuery = new ParseQuery("OutletOffers");
$offerQuery->equalTo("outlet", $outlet);
$offerQuery->equalTo("offerStatus", "live");
$beacQuery = new ParseQuery("Beacons");
$beacQuery->equalTo("outlet", $outlet);
$beacresults = $beacQuery->count();
$offerResults = $offerQuery->count();
$outletInfo[] = ['venueName' => $object->get('outletName'), 'beacons' => $beacresults, 'offers' => $offerResults, 'venueId' => $object->getObjectId()];
}
return $outletInfo;
}
示例3: addTask
public function addTask(Request $request)
{
$parseTask = new ParseObject("Task");
$parseCropQuery = new ParseQuery("Crop");
$parseCropQuery->equalTo("cropName", $request->input('crop'));
$crop = $parseCropQuery->first();
$parseQuery = new ParseQuery("Task");
$parseQuery->equalTo("cropName", $crop);
$parseQuery->equalTo("taskDesc", $request->input('taskName'));
if ($parseQuery->count() > 0) {
return redirect('/tasks');
}
$parseTask->set("cropName", $crop);
$parseTask->set("taskDesc", $request->input('taskName'));
$parseTask->set("taskDuration", $request->input('taskDuration'));
$parseTask->set("taskStart", $request->input('taskStart'));
try {
$parseTask->save();
\Session::put('message', 1);
return redirect('tasks');
} catch (ParseException $e) {
\Session::put('message', -1);
return redirect('tasks');
}
}
示例4: indexAction
/**
* Lists all ProjectsAdmin entities.
*
* @Route("/index/{page}", name="admin_projects", defaults={ "page" = 1 })
* @Method("GET")
* @Template()
*/
public function indexAction($page)
{
$query = new ParseQuery('Project');
$query->ascending("label");
$query->limit(12);
$query->skip(12 * ($page - 1));
$entities = $query->find();
return array('entities' => $entities, 'hits' => ceil($query->count() / 12), 'page' => $page, 'csrf' => $this->get('form.csrf_provider'));
}
开发者ID:leonardobarrientosc,项目名称:4046-PUCV-ICC-FICHAS-OBRAS-CIVILES,代码行数:16,代码来源:ProjectsAdminController.php
示例5: testFind
public function testFind()
{
Helper::clearClass('TestObject');
$obj = ParseObject::create('TestObject');
$obj->set('foo', 'bar');
$obj->save();
$query = new ParseQuery('TestObject');
$query->equalTo('foo', 'bar');
$response = $query->count();
$this->assertTrue($response == 1);
}
示例6: traerCategorias
public function traerCategorias()
{
//$categorias = new stdClass();
$query = new ParseQuery("noticias");
$query->equalTo("categorias", "noticia");
$categorias[0]['nombre'] = 'noticia';
$categorias[0]['num'] = $query->count();
$query->equalTo("categorias", "intervencion");
$categorias[1]['nombre'] = 'intervenciones';
$categorias[1]['num'] = $query->count();
$query->equalTo("categorias", "video");
$categorias[2]['nombre'] = 'videos';
$categorias[2]['num'] = $query->count();
$query->equalTo("categorias", "iniciativa");
$categorias[3]['nombre'] = 'iniciativas';
$categorias[3]['num'] = $query->count();
$query->equalTo("categorias", "prensa");
$categorias[4]['nombre'] = 'prensa';
$categorias[4]['num'] = $query->count();
$query->equalTo("categorias", "comunicado");
$categorias[5]['nombre'] = 'comunicados';
$categorias[5]['num'] = $query->count();
return $categorias;
}
示例7: get_beacons
public function get_beacons()
{
$user = ParseUser::getCurrentUser();
$outletCheck = $user->get("outlet");
$outletCheck->fetch();
$sectionId = $this->uri->segment(4);
$section = new ParseObject("Sections", $sectionId);
$beaconQuery = new ParseQuery("Beacons");
$beaconQuery->equalTo("section", $section);
$beaconQuery->equalTo("outlet", $outletCheck);
$result = $beaconQuery->count();
if (!empty($result)) {
$beaconInfo = [];
$beaconInfo['234'] = $result;
echo json_encode($beaconInfo);
} else {
echo 'none';
}
}
示例8: testRestrictedCount
public function testRestrictedCount()
{
$obj = ParseObject::create("TestObject");
$restrictedACL = new ParseACL();
$obj->setACL($restrictedACL);
$obj->save();
$query = new ParseQuery("TestObject");
$count = $query->count();
$this->assertEquals(0, $count);
$count = $query->count(true);
$this->assertEquals(1, $count);
}
示例9: submitForm
public function submitForm(Request $request)
{
$parseCrop = new ParseObject("Crop");
$newCropType = new CropTypeBusiness();
/*$crop->strCropType = $request->input('cropType');
$crop->strCropName = $request->input('cropName');
$crop->dblMinPh = $request->input('minPh');
$crop->dblMaxPh = $request->input('maxPh');
$crop->$dblMinSunlight = $request->input('minSunlight');
$crop->$dblMaxSunlight = $request->input('maxSunlight');
$crop->$dblMinMoisture = $request->input('minMoisture');
$crop->$dblMaxMoisture = $request->input('maxMoisture');
$crop->$dblMinTemp = $request->input('minTemp');
$crop->$dblMaxTemp = $request->input('maxTemp');
$crop->$dblPlantingDistance = $request->input('plantDist');
$crop->$strSeason = $request->input('season');
$crop->$strFertilizer = $request->input('fertSelect');
$crop->$dblAmountOfFertilizer = $request->input('fertAmt');
//$crop->$listTask = $request->input('listTask'); //how listTask? how array?
public $strCropName;
public $strCropType;
public $dblMinPh;
public $dblMaxPh;
public $dblMinSunlight;
public $dblMaxSunlight;
public $dblMinMoisture;
public $dblMaxMoisture;
public $dblMinTemp;
public $dblMaxTemp;
public $dblPlantingDistance;
public $strSeason;
public $strFertilizer;
public $dblAmountOfFertilizer;
$status = $this->cropBusiness($this->crop);
if ($status == "error-validation"){
}
else if ($status == "error-validation"){
}
else if ($status == "success"){
}*/
$cropTypeVar = null;
$fertTypeVar = null;
$parseCropType = null;
$parseFertilizer = null;
$parseQuery = new ParseQuery("Crop");
$parseQuery->equalTo("cropName", $request->input('cropName'));
if ($parseQuery->count() > 0) {
return redirect('/maintenance');
}
$parseCrop->set("cropName", $request->input('cropName'));
$parseCrop->set("price", $request->input('cropPrice'));
$parseCrop->set("minPh", $request->input('minPh'));
$parseCrop->set("maxPh", $request->input('maxPh'));
$parseCrop->set("minMoisture", $request->input('minMoisture'));
$parseCrop->set("maxMoisture", $request->input('maxMoisture'));
$parseCrop->set("minSunlight", $request->input('minSunlight'));
$parseCrop->set("maxSunlight", $request->input('maxSunlight'));
$parseCrop->set("minTemp", $request->input('minTemp'));
$parseCrop->set("maxTemp", $request->input('maxTemp'));
$parseCrop->set("plantingDistance", $request->input('plantDist'));
$parseCrop->set("fertilizerAmount", $request->input('fertAmt'));
$parseCrop->set("season", $request->input('season'));
$parseCrop->set("cropDesc", $request->input('cropDesc'));
$parseCrop->set("daysBeforeHarvest", $request->input('cropBeforeHarvest'));
// Tawag mo nalang
if ($request->input('newcroptype') == null || strcmp($request->input('newcroptype'), "") == 0) {
$parseQuery = new ParseQuery("CropType");
$parseQuery->equalTo("cropTypeDesc", $request->input('cropType'));
$cropType = $parseQuery->first();
$parseCrop->set("cropType", $cropType);
} else {
$cropTypeVar = $request->input('newcroptype');
$parseQuery = new ParseQuery("CropType");
$parseQuery->equalTo("cropTypeDesc", $cropTypeVar);
if ($parseQuery->count() > 0) {
$cropType = $parseQuery->first();
$parseCrop->set("cropType", $cropType);
} else {
$parseCropType = new ParseObject("CropType");
$parseCropType->set("cropTypeDesc", $cropTypeVar);
$parseCropType->save();
$parseCrop->set("cropType", $parseCropType);
}
}
if ($request->input('newferttype') == null || strcmp($request->input('newferttype'), "") == 0) {
$parseQuery = new ParseQuery("Fertilizer");
$parseQuery->equalTo("fertilizerDesc", $request->input('fertSelect'));
$fertilizer = $parseQuery->first();
$parseCrop->set("fertilizer", $fertilizer);
} else {
$fertTypeVar = $request->input('newferttype');
$parseQuery = new ParseQuery("Fertilizer");
$parseQuery->equalTo("fertilizerDesc", $fertTypeVar);
if ($parseQuery->count() > 0) {
//.........这里部分代码省略.........
示例10: agregarAFavoritos
public static function agregarAFavoritos($inmueble)
{
$usuario = APIUsuario::usuarioActual();
if (!$usuario->isAuthenticated()) {
return false;
}
$query = new ParseQuery("Favoritos");
$query->equalTo("idInmueble", $inmueble);
$query->equalTo("idUsuario", $usuario);
if ($query->count() > 0) {
return;
}
$favoritos = new ParseObject("Favoritos");
$favoritos->set("idInmueble", $inmueble);
$favoritos->set("idUsuario", $usuario);
$favoritos->save();
}
示例11: ParseQuery
<?php
session_start();
require 'vendor/autoload.php';
use Parse\ParseClient;
use Parse\ParseObject;
use Parse\ParseQuery;
ParseClient::initialize('ilAdpSlcSs2PYQzZtC9k549MMrEq6GWBEkgPL052', '2ptwsyysoXq6KZ055Rz6qgAVLc6kGqq4geBcYGrV', '5o87OulNuELCkqYB3cju1ETOcLllLqB5K13F12Pg');
try {
$query = new ParseQuery("Merchant");
$query->equalTo("contact_no", $_POST['mobileno']);
if ($query->count() >= 1) {
header('location:merchantregister.php');
} else {
$name = $_POST['name'];
$email = $_POST['email'];
$mobileno = $_POST['mobileno'];
$address = $_POST['address'];
$location = $_POST['location'];
$password = $_POST['password'];
$testObject = ParseObject::create("Merchant");
$testObject->set("Mname", $name);
$testObject->set("contact_no", $mobileno);
$testObject->set("Prefer_Location", $location);
$testObject->set("emailId", $email);
$testObject->set("Address", $address);
$testObject->set("password", md5($password));
$testObject->set("mob_verified", 1);
$_SESSION["contact_no"] = $testObject->get("contact_no");
$testObject->save();
header('location:merchantdashboard.php');
示例12: get_beacons
public function get_beacons($venueId)
{
$venue = new ParseObject("Outlets", $venueId);
$sectionId = $this->uri->segment(5);
$section = new ParseObject("Sections", $sectionId);
$beaconQuery = new ParseQuery("Beacons");
$beaconQuery->equalTo("section", $section);
$beaconQuery->equalTo("outlet", $venue);
$result = $beaconQuery->count();
if (!empty($result)) {
$beaconInfo = [];
$beaconInfo['234'] = $result;
echo json_encode($beaconInfo);
} else {
echo 'none';
}
}
示例13: count
public function count()
{
return $this->parseQuery->count($this->useMasterKey);
}
示例14: saveCrop
public function saveCrop($crop)
{
$queryCrop = new ParseQuery("Crop");
$queryCropType = new ParseQuery("CropType");
$querySeason = new ParseQuery("Season");
$queryFertilizer = new ParseQuery("Fertilizer");
$queryTaskCategory = new ParseQuery("TaskCategory");
$parseCrop = new ParseObject("Crop");
$parseTask = new ParseObject("Task");
try {
$queryCrop->equalTo("cropName", $crop->strCropName);
if ($queryCrop->count() != 0) {
return "existing";
}
//getting crop type
$queryCropType->equalTo("cropTypeDesc", $crop->strCropType);
if ($queryCrop->count() == 0) {
$parseCropType = new ParseObject("TaskCategory");
$parseCropType->set("taskCatDesc", $crop->strCropType);
$parseCropType->save();
}
$cropType = $queryCropType->first();
//getting season
$querySeason->equalTo("seasonDesc", $crop->strSeason);
if ($querySeason->count() == 0) {
$parseSeason = new ParseObject("Season");
$parseSeason->set("seasonDesc", $crop->strSeason);
$parseSeason->save();
}
$season = $querySeason->first();
//getting fertilizer
$queryFertilizer->equalTo("fertilizerDesc", $crop->strFertilizer);
if ($queryFertilizer->count() == 0) {
$parseFertilizer = new ParseObject("Fertilizer");
$parseFertilizer->set("fertilizerDesc", $crop->strSeason);
$parseFertilizer->save();
}
$fertilizer = $queryFertilizer->first();
$parseCrop->set("cropName", $crop->strCropName);
$parseCrop->set("cropType", $cropType);
$parseCrop->set("minPh", $crop->dblMinPh);
$parseCrop->set("maxPh", $crop->dblMaxPh);
$parseCrop->set("minMoisture", $crop->dblMinMoisture);
$parseCrop->set("maxMoisture", $crop->dblMaxMoisture);
$parseCrop->set("minSunlight", $crop->dblMinSunlight);
$parseCrop->set("maxSunlight", $crop->dblMaxSunlight);
$parseCrop->set("minTemp", $crop->dblMinTemp);
$parseCrop->set("maxTemp", $crop->dblMaxTemp);
$parseCrop->set("plantingDistance", $crop->dblPlantingDistance);
$parseCrop->set("season", $season);
$parseCrop->set("fertilizer", $fertilizer);
$parseCrop->set("fertilizerAmount", $crop->dblAmountOfFertilizer);
//adding tasks
foreach ($crop->listTask as $task) {
$queryTaskCategory->equalTo("taskCatDesc", $task->strTaskName);
$taskCategory = $queryTaskCategory->first();
if ($queryTaskCategory->count() == 0) {
$parseTaskCategory = new ParseObject("TaskCategory");
$parseTaskCategory->set("taskCatDesc", $crop->strTaskName);
$parseTaskCategory->save();
}
//end if()
$parseTask->set("taskCategory", $taskCategory);
$parseTask->set("taskDesc", $task->strTaskDesc);
$parseTask->set("taskDuration", $task->intTaskDuration);
$parseTask->save();
}
//end foreach
return "success";
} catch (Exception $e) {
dd($e);
}
//end try catch()
return "error-database";
}
示例15: parseUserUnique
public function parseUserUnique($attribute, $value, $parameters)
{
$query = new ParseQuery('_User');
$query->equalTo('username', $value);
return !(bool) $query->count();
}