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


PHP Review::getRestaurantId方法代码示例

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


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

示例1: Cuisine

 function test_getRestaurantId()
 {
     $name = "Asian";
     $id = null;
     $test_cuisine = new Cuisine($name, $id);
     $test_cuisine->save();
     $restaurant_name = "The Golden Duck";
     $location = "898 SW 5th Ave, Portland, OR";
     $description = "A Chill Asian experince";
     $price = "\$\$";
     $cuisine_id = $test_cuisine->getId();
     $test_restaurant = new Restaurant($restaurant_name, $location, $description, $price, $cuisine_id);
     $test_restaurant->save();
     //var_dump($test_restaurant);
     $user = "yoloswag1959";
     $stars = 3;
     $headline = "It is aight.";
     $body = "Yeah pretty aight bro";
     $restaurant_id = $test_restaurant->getId();
     //var_dump($restaurant_id);
     $test_review = new Review($user, $stars, $headline, $body, $restaurant_id);
     $test_review->save();
     //var_dump($test_review);
     $result = $test_review->getRestaurantId();
     $this->assertEquals($restaurant_id, $result);
 }
开发者ID:juliocesardiaz,项目名称:Best-restaurants,代码行数:26,代码来源:ReviewTest.php

示例2: Cuisine

 function test_restaurantId()
 {
     //cuisine
     $name = "Japanese";
     $id = null;
     $test_cuisine = new Cuisine($name, $id);
     $test_cuisine->save();
     //restaurant
     $name = "Good Fortune";
     $description = "very tasty.";
     $address = "1111 SW 11th Ave";
     $cuisine_id = $test_cuisine->getId();
     $test_restaurant = new Restaurant($name, $id, $cuisine_id, $description, $address);
     $test_restaurant->save();
     //review
     $username = "Ben";
     $date = 00 - 00 - 00;
     $rating = 5;
     $comment = "good one.";
     $restaurant_id = $test_restaurant->getId();
     $test_review = new Review($username, $date, $rating, $comment, $restaurant_id, $id);
     $test_review->save();
     $result = $test_review->getRestaurantId();
     $this->assertEquals(true, is_numeric($result));
 }
开发者ID:Camolot,项目名称:restaurants,代码行数:25,代码来源:ReviewTest.php

示例3: Restaurant

 function test_getRestaurantId()
 {
     $restaurant = new Restaurant("Pok Pok", 2, "555-555-555", "123 ABC Street", "http://www.com", 2);
     $name = "Bob";
     $id = null;
     $rating = 3;
     $review_text = "Blah blah blah";
     $review_date = "2015/10/10";
     $restaurant_id = $restaurant->getId();
     $test_Review = new Review($name, $id, $rating, $review_text, $review_date, $restaurant_id);
     $result = $test_Review->getRestaurantId();
     $this->assertEquals($restaurant_id, $result);
 }
开发者ID:jeffaustin81,项目名称:Restaurants,代码行数:13,代码来源:ReviewTest.php

示例4: Restaurant

    $restaurant = new Restaurant($_POST['name'], $_POST['location'], $_POST['description'], $_POST['price'], $_POST['cuisine_id']);
    $restaurant->save();
    $cuisine = Cuisine::find($restaurant->getCuisineId());
    return $app['twig']->render('cuisine.html.twig', array('cuisine' => $cuisine, 'restaurants' => Restaurant::getAll()));
});
$app->get("/restaurants/{id}", function ($id) use($app) {
    $restaurant = Restaurant::find($id);
    return $app['twig']->render('restaurant.html.twig', array('restaurant' => $restaurant, 'reviews' => Review::getAll()));
});
$app->get("/restaurants/{id}/edit", function ($id) use($app) {
    $restaurant = Restaurant::find($id);
    return $app['twig']->render('restaurant_edit.html.twig', array('restaurant' => $restaurant));
});
$app->patch("/restaurants/{id}", function ($id) use($app) {
    $restaurant = Restaurant::find($id);
    $restaurant->update($_POST['name'], $_POST['location'], $_POST['description'], $_POST['price'], $_POST['cuisine_id']);
    return $app['twig']->render('restaurant.html.twig', array('restaurant' => $restaurant, 'reviews' => Review::getAll()));
});
$app->delete("/restaurants/{id}", function ($id) use($app) {
    $restaurant = Restaurant::find($id);
    $cuisine = Cuisine::find($restaurant->getCuisineId());
    $restaurant->delete();
    return $app['twig']->render('cuisine.html.twig', array('cuisine' => $cuisine, 'restaurants' => Restaurant::getAll()));
});
$app->post("/reviews", function () use($app) {
    $review = new Review($_POST['user'], $_POST['stars'], $_POST['headline'], $_POST['body'], $_POST['restaurant_id']);
    $review->save();
    $restaurant = Restaurant::find($review->getRestaurantId());
    return $app['twig']->render('restaurant.html.twig', array('restaurant' => $restaurant, 'reviews' => Review::getAll()));
});
return $app;
开发者ID:juliocesardiaz,项目名称:Best-restaurants,代码行数:31,代码来源:app.php


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