示例#1
0
 protected function proceed()
 {
     switch ($this->action) {
         case 'get':
             $this->succeed(PlacesService::getFloor($this->params['id']));
             break;
         case 'getAll':
             $this->succeed(PlacesService::getAllFloors());
             break;
     }
 }
示例#2
0
 protected function setUp()
 {
     $this->floors = array();
     // Create some floors and places
     $floor1 = new Floor("Floor", false);
     $floor1->id = PlacesService::createFloor($floor1, null);
     $placeA = new Place("A", 5, 10, $floor1->id);
     $placeB = new Place("B", 30, 50, $floor1->id);
     $placeA->id = PlacesService::createPlace($placeA);
     $placeB->id = PlacesService::createPlace($placeB);
     $floor1->addPlace($placeA);
     $floor1->addPlace($placeB);
     $floor2 = new Floor("Rooftop", false);
     $floor2->id = PlacesService::createFloor($floor2, null);
     $placeC = new Place("C", 10, 20, $floor2->id);
     $placeD = new Place("D", 50, 15, $floor2->id);
     $placeC->id = PlacesService::createPlace($placeC);
     $placeD->id = PlacesService::createPlace($placeD);
     $floor2->addPlace($placeC);
     $floor2->addPlace($placeD);
     $this->floors[] = $floor1;
     $this->floors[] = $floor2;
 }
示例#3
0
 static function getPlace($id)
 {
     $pdo = PDOBuilder::getPDO();
     $stmt = $pdo->prepare("SELECT * FROM PLACES WHERE ID = :id");
     if ($stmt->execute(array(':id' => $id))) {
         if ($row = $stmt->fetch()) {
             return PlacesService::buildDBFloor($row, $pdo);
         }
     }
     return null;
 }