當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Restaurant類代碼示例

本文整理匯總了PHP中Restaurant的典型用法代碼示例。如果您正苦於以下問題:PHP Restaurant類的具體用法?PHP Restaurant怎麽用?PHP Restaurant使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Restaurant類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fest_allRestaurantsInCuisine

 function fest_allRestaurantsInCuisine()
 {
     //Arrange
     $cuisine = "Pizza";
     $test_cuisine = new Cuisine($cuisine);
     $test_cuisine->save();
     $cuisine = "Burgers";
     $test_cuisine2 = new Cuisine($cuisine);
     $test_cuisine2->save();
     $restaurant_name = "Antoons";
     $cuisine_type = 1;
     $restaurant_phone = "4128675309";
     $restaurant_address = "123 Atwood St";
     $test_Restaurant = new Restaurant($restaurant_name, $cuisine_type, $restaurant_phone, $restaurant_address);
     $test_Restaurant->save();
     $restaurant_name = "Spankys";
     $cuisine_type = 2;
     $restaurant_phone = "8015715713";
     $restaurant_address = "379 E 3333 S";
     $test_next_Restaurant = new Restaurant($restaurant_name, $cuisine_type, $restaurant_phone, $restaurant_address);
     $test_next_Restaurant->save();
     $restaurant_name = "Dave & Busters";
     $cuisine_type = 1;
     $restaurant_phone = "44444444";
     $restaurant_address = "HELL";
     $test_third_restaurant = new Restaurant($restaurant_name, $cuisine_type, $restaurant_phone, $restaurant_address);
     $test_third_restaurant->save();
     //Act
     $result = Cuisine::getRestaurants();
     //Assert
     $this->assertEquals([$test_Restaurant, $test_third_restaurant], $result);
 }
開發者ID:kellimargaret,項目名稱:restaurants,代碼行數:32,代碼來源:CuisineTest.php

示例2: test_GetRestaurants

 function test_GetRestaurants()
 {
     //Arrange
     $name = "Drinks";
     $id = null;
     $test_cuisine = new Cuisine($name, $id);
     $test_cuisine->save();
     $restaurant = "Aalto";
     $address = "123 Belmont";
     $phone = "123-456-7890";
     $cuisine_id = $test_cuisine->getId();
     $id = 1;
     $test_restaurant = new Restaurant($restaurant, $address, $phone, $cuisine_id, $id);
     $test_restaurant->save();
     $restaurant2 = "Aalto";
     $address2 = "123 Belmont";
     $phone2 = "123-456-7890";
     $cuisine_id2 = $test_cuisine->getId();
     $id = 2;
     $test_restaurant2 = new Restaurant($restaurant, $address, $phone, $cuisine_id, $id);
     $test_restaurant2->save();
     //Act
     $result = $test_cuisine->getRestaurants();
     //Assert
     $this->assertEquals([$test_restaurant, $test_restaurant2], $result);
 }
開發者ID:sammartinez,項目名稱:restaurant_project,代碼行數:26,代碼來源:CuisineTest.php

示例3: createTableRow

function createTableRow(Restaurant $rest)
{
    print "<tr>\n";
    print "<td>" . $rest->getRestName() . "</td>\n";
    print "<td>" . $rest->getCuisName() . "</td>\n";
    print "<td>" . $rest->getCityName() . "</td>\n";
    print "<td>" . $rest->getPrngName() . "</td>\n";
    print "</tr>\n";
}
開發者ID:alexandralomotan,項目名稱:cs174,代碼行數:9,代碼來源:_restaurants.php

示例4: test_find

 function test_find()
 {
     //Arrange
     $restaurant_name = "Antoons";
     $cuisine_type = 1;
     $restaurant_phone = "4128675309";
     $restaurant_address = "123 Atwood St";
     $test_Restaurant = new Restaurant($restaurant_name, $cuisine_type, $restaurant_phone, $restaurant_address);
     $test_Restaurant->save();
     //Act
     $result = Restaurant::find($test_Restaurant->getId());
     //Assert
     $this->assertEquals($test_Restaurant, $result);
 }
開發者ID:kellimargaret,項目名稱:restaurants,代碼行數:14,代碼來源:RestaurantTest.php

示例5: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Restaurant::create(['name' => $faker->company, 'latitude' => $faker->randomFloat(5, -90, 90), 'longitude' => $faker->randomFloat(5, -180, 180)]);
     }
 }
開發者ID:andrewhood125,項目名稱:smart-buzzer,代碼行數:7,代碼來源:RestaurantsTableSeeder.php

示例6: testAddRestaurant

 public function testAddRestaurant()
 {
     $myRest = new Restaurant("23", "12", true, "Rue du test unitaire", "AGILE", "Superbe resto qui s'emmerde a faire des tests unitaire.", "Unit tests", "32456", "http://www.facebook.com");
     $objectId = $myRest->add();
     $query = new ParseQuery("Restaurant");
     $query->equalTo("objectId", $objectId);
     $results = $query->find();
     $this->assertEquals(1, count($results));
     $resto = $results[0];
     $this->assertEquals("Rue du test unitaire", $resto->get("address"));
     $this->assertEquals("AGILE", $resto->get("city"));
     $this->assertEquals("Superbe resto qui s'emmerde a faire des tests unitaire.", $resto->get("description"));
     $this->assertEquals("Unit tests", $resto->get("name"));
     $this->assertEquals("32456", $resto->get("postal"));
     $this->assertEquals("http://www.facebook.com", $resto->get("website"));
 }
開發者ID:benji031,項目名稱:finduscook,代碼行數:16,代碼來源:TestAddingRestaurants.php

示例7: productos

 public function productos($mozos = null)
 {
     $recordFinder = new AsyncRecordFinder('Buscar Producto', Restaurant::getInstance()->productos());
     $recordFinder->addSearchFieldFree('codigo', 'Codigo');
     $recordFinder->addSearchFieldFree('nombre', 'Nombre');
     $recordFinder->addTitleField('codigo', 'Codigo');
     $recordFinder->addTitleField('nombre', 'Nombre');
     return $recordFinder->generateXmlConfiguration();
 }
開發者ID:BGCX261,項目名稱:zoorestaurant-svn-to-git,代碼行數:9,代碼來源:AsyncSearch.class.php

示例8: delete

 function delete()
 {
     $restaurants = Restaurant::getAll();
     foreach ($restaurants as $restaurant) {
         if ($restaurant->getCuisineId() == $this->getId()) {
             $restaurant->delete();
         }
     }
     $GLOBALS['DB']->exec("DELETE FROM cuisines WHERE id = {$this->getId()};");
 }
開發者ID:juliocesardiaz,項目名稱:Best-restaurants,代碼行數:10,代碼來源:Cuisine.php

示例9: find

 static function find($search_id)
 {
     $found_restaurant = null;
     $restaurants = Restaurant::getAll();
     foreach ($restaurants as $restaurant) {
         $restaurant_id = $restaurant->getId();
         if ($restaurant_id == $search_id) {
             $found_restaurant = $restaurant;
         }
     }
     return $found_restaurant;
 }
開發者ID:anniehoogendoorn,項目名稱:BestRestaurants,代碼行數:12,代碼來源:Restaurant.php

示例10: initialize

 public function initialize($entity = null, $options = null)
 {
     $restaurant = new Select('restaurantid', Restaurant::find(), array('using' => array('id', 'name'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Seleccione un Restaurante')));
     $restaurant->setLabel('Pais');
     $this->add($restaurant);
     $name = new Text('name');
     $name->setLabel('Name');
     $this->add($name);
     $active = new Select("active", array('Y' => $this->di->get('translate')->_('Yes'), 'N' => $this->di->get('translate')->_('No')), array('class' => 'form-control'));
     $active->setLabel('active');
     $this->add($active);
 }
開發者ID:andresfranco,項目名稱:Phalcontest,代碼行數:12,代碼來源:MenuForm.php

示例11: restaurantInfo

 public function restaurantInfo()
 {
     $user = \Auth::user();
     $id = $user->user_id;
     $restaurant = \Restaurant::all();
     foreach ($restaurant as $rest) {
         $restaurant_name = $rest->restaurant_name;
         $restaurant_street_1 = $rest->restaurant_street_1;
         $restaurant_street_2 = $rest->restaurant_street_2;
         $restaurant_phone = $rest->restaurant_phone;
         $restaurant_email = $rest->restaurant_email;
     }
     return \View::make('restaurant.edit')->withRestaurantName($restaurant_name)->withRestaurantStreet_1($restaurant_street_1)->withRestaurantStreet_2($restaurant_street_2)->withRestaurantPhone($restaurant_phone)->withRestaurantEmail($restaurant_email);
 }
開發者ID:adamyWA,項目名稱:Menu-CMS,代碼行數:14,代碼來源:UpdateRestaurantInfo.php

示例12: addReview

 public function addReview($data)
 {
     $this->user_id = $data['user_id'];
     $this->restaurant_id = $data['restaurant_id'];
     $this->content = $data['content'];
     $this->rating = $data['rating'];
     $this->created_at = $data['created_at'] = date('Y-m-d H:i:s');
     $this->updated_at = $data['updated_at'] = date('Y-m-d H:i:s');
     if ($this->create($data)) {
         $restaurants = new Restaurant();
         $restaurant = $restaurants->find('id', $this->restaurant_id);
         $review_count = intval($restaurant['review_count']);
         $rating = $review_count * intval($restaurant['rating']) + intval($this->rating);
         $review_count += 1;
         $rating /= $review_count;
         $restaurants->update('id', $this->restaurant_id, ['rating' => $rating, 'review_count' => $review_count]);
         $result['status'] = "success";
         $result['success_text'] = "review added";
     } else {
         $result['status'] = "error";
         $result['error_text'] = "review not added";
     }
     return json_encode($result);
 }
開發者ID:manikanthtalasu,項目名稱:restaurant-finder,代碼行數:24,代碼來源:review.php

示例13: buildAtms

 public function buildAtms($xml)
 {
     $pageOffset = (string) $xml->PageOffset;
     $totalCount = (string) $xml->TotalCount;
     $restaurantArray = array();
     foreach ($xml->Restaurant as $restaurant) {
         $tmpRestaurant = new Restaurant();
         $tmpRestaurant->setId((string) $restaurant->Id);
         $tmpRestaurant->setName((string) $restaurant->Name);
         $tmpRestaurant->setWebsiteUrl((string) $restaurant->WebsiteUrl);
         $tmpRestaurant->setPhoneNumber((string) $restaurant->PhoneNumber);
         $tmpRestaurant->setCategory((string) $restaurant->Category);
         $tmpRestaurant->setLocalFavoriteInd((string) $restaurant->LocalFavoriteInd);
         $tmpRestaurant->setHiddenGemInd((string) $restaurant->HiddenGemInd);
         $tmpLocation = new Location();
         $location = $restaurant->Location;
         $tmpLocation->setName((string) $location->Name);
         $tmpLocation->setDistance((string) $location->Distance);
         $tmpLocation->setDistanceUnit((string) $location->DistanceUnit);
         $tmpAddress = new Address();
         $address = $location->Address;
         $tmpAddress->setLine1((string) $address->Line1);
         $tmpAddress->setLine2((string) $address->Line2);
         $tmpAddress->setCity((string) $address->City);
         $tmpAddress->setPostalCode((string) $address->PostCode);
         $tmpCountry = new Country();
         $tmpCountry->setName((string) $address->Country->Name);
         $tmpCountry->setCode((string) $address->Country->Code);
         $tmpCountrySubdivision = new CountrySubdivision();
         $tmpCountrySubdivision->setName((string) $address->CountrySubdivision->Name);
         $tmpCountrySubdivision->setCode((string) $address->CountrySubdivision->Code);
         $tmpAddress->setCountry($tmpCountry);
         $tmpAddress->setCountrySubdivision($tmpCountrySubdivision);
         $tmpPoint = new Point();
         $point = $location->Point;
         $tmpPoint->setLatitude((string) $point->Latitude);
         $tmpPoint->setLongitude((string) $point->Longitude);
         $tmpLocation->setPoint($tmpPoint);
         $tmpLocation->setAddress($tmpAddress);
         $tmpRestaurant->setLocation($tmpLocation);
         array_push($restaurantArray, $tmpRestaurant);
     }
     $restaurants = new Restaurants($pageOffset, $totalCount, $restaurantArray);
     return $restaurants;
 }
開發者ID:vicenteguerra,項目名稱:Flashbuy,代碼行數:45,代碼來源:RestaurantsLocalFavoritesService.php

示例14: abrir

 /**
  * abre la mesa y setea el mozo
  * @param Mozo $mozo
  */
 public function abrir($mozo)
 {
     //$this->getPedido()->vaciar();
     if (!$this->getEstado()->equals(EstadoMesa::abierta())) {
         $this->setFechaAbierta(DateUtil::formatAsTimeStamp(time()));
         $this->setearMozoYEstado($mozo, EstadoMesa::abierta());
         $pedido = new Pedido();
         //$pedido->setNumero(21);//clase aca
         //$pedido->setFecha($this->getFechaAbierta());
         $restaurant = Restaurant::getInstance()->agregarPedido($pedido);
         $pedido->save();
         $this->setPedido($pedido);
         return true;
     }
     return false;
 }
開發者ID:BGCX261,項目名稱:zoorestaurant-svn-to-git,代碼行數:20,代碼來源:Mesa.class.php

示例15: construct

 public function construct()
 {
     if ($this->isNew()) {
         try {
             parent::construct();
             $this->setEstado(EstadoPedido::pendiente());
             $this->setFecha(DateUtil::formatAsTimeStamp(time()));
             $this->setNumero(Restaurant::getInstance()->pedidos()->count() + 1);
         } catch (Exception $e) {
             /**
              * This try/catch clause is necessary to prevent the Doctrine data loader command from
              * failing.
              *
              */
         }
     }
 }
開發者ID:BGCX261,項目名稱:zoorestaurant-svn-to-git,代碼行數:17,代碼來源:Pedido.class.php


注:本文中的Restaurant類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。