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


PHP Listing::getListingByListingId方法代码示例

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


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

示例1: elseif

             $pusher->trigger("listing", "update", $listing);
             //if this isn't supposed to be an admin, take away the temporary admin access
             $security = Volunteer::getVolunteerByVolId($pdo, $_SESSION["volunteer"]->getVolId());
             if ($security->getVolIsAdmin() === false) {
                 $_SESSION["volunteer"]->setVolIsAdmin(false);
             }
             $reply->message = "Listing updated OK";
         } elseif ($method === "POST") {
             //create new listing
             $listing = new Listing(null, $_SESSION["volunteer"]->getOrgId(), $requestObject->listingClaimedBy, $requestObject->listingClosed, $requestObject->listingCost, $requestObject->listingMemo, $requestObject->listingParentId, $requestObject->listingPostTime, $requestObject->listingTypeId);
             $listing->insert($pdo);
             $pusher->trigger("listing", "new", $listing);
             $reply->message = "Listing created OK";
         }
     } elseif ($method === "DELETE") {
         $listing = Listing::getListingByListingId($pdo, $id);
         if ($listing === null) {
             throw new RuntimeException("Listing does not exist", 404);
         }
         $listing->delete($pdo);
         $deletedObject = new stdClass();
         $deletedObject->listingId = $id;
         $pusher->trigger("listing", "delete", $deletedObject);
         $reply->message = "Listing deleted OK";
     }
 } else {
     //if not an admin and attempting a method other than get, throw an exception
     if (empty($method) === false && $method !== "GET") {
         throw new RangeException("Only administrators are allowed to modify entries", 401);
     }
 }
开发者ID:brbrown59,项目名称:bread-basket,代码行数:31,代码来源:index.php

示例2: testGetInvalidListingByListingId

 /**
  * test getting an organization by listing id that doesn't exist
  */
 public function testGetInvalidListingByListingId()
 {
     $listing = Listing::getListingByListingId($this->getPDO(), BreadBasketTest::INVALID_KEY);
     $this->assertNull($listing);
 }
开发者ID:brbrown59,项目名称:bread-basket,代码行数:8,代码来源:listing-test.php

示例3: testValidDelete

 /**
  * test deleting a valid listing in the database
  * */
 public function testValidDelete()
 {
     //create a new listing, and insert it
     $listing = new Listing(null, $this->organization->getOrgId(), $this->VALID_CLAIMEDBY, $this->VALID_LISTINGCLOSED, $this->VALID_COST, $this->VALID_MEMO, $this->VALID_PARENT_ID, $this->valid_datetime, $this->listingType->getListingTypeId());
     $listing->insert($this->getPDO());
     //perform the actual delete
     $response = $this->guzzle->delete('https://bootcamp-coders.cnm.edu/~bbrown52/bread-basket/public_html/php/api/listing/' . $listing->getListingId(), ['headers' => ['X-XSRF-TOKEN' => $this->token]]);
     //grab the data from guzzle and enforce that the status codes are correct
     $this->assertSame($response->getStatusCode(), 200);
     $body = $response->getBody();
     $retrievedListing = json_decode($body);
     $this->assertSame(200, $retrievedListing->status);
     //try retrieving entry from database and ensure it was deleted
     $deletedListing = Listing::getListingByListingId($this->getPDO(), $listing->getOrgId());
     $this->assertNull($deletedListing);
 }
开发者ID:brbrown59,项目名称:bread-basket,代码行数:19,代码来源:listing-api-test.php


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