本文整理汇总了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);
}
示例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);
}
示例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";
}
示例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);
}
示例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)]);
}
}
示例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"));
}
示例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();
}
示例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()};");
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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.
*
*/
}
}
}