当前位置: 首页>>代码示例>>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;未经允许,请勿转载。