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


PHP Review::findReview方法代碼示例

本文整理匯總了PHP中Review::findReview方法的典型用法代碼示例。如果您正苦於以下問題:PHP Review::findReview方法的具體用法?PHP Review::findReview怎麽用?PHP Review::findReview使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Review的用法示例。


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

示例1: addUser

 function addUser($user_id)
 {
     if (Review::findReview($this->getId(), $user_id) == false) {
         $GLOBALS['DB']->exec("INSERT INTO reviews (beer_id, user_id) VALUES ({$this->getId()}, {$user_id});");
     }
 }
開發者ID:bborealis,項目名稱:growler,代碼行數:6,代碼來源:Beer.php

示例2: addBeer

 function addBeer($beer)
 {
     $user_id = $this->getId();
     if (Review::findReview($beer, $user_id) == false) {
         $GLOBALS['DB']->exec("INSERT INTO reviews (beer_id, user_id) VALUES ({$beer}, {$this->getId()});");
     }
 }
開發者ID:bborealis,項目名稱:growler,代碼行數:7,代碼來源:User.php

示例3: test_findReview

 function test_findReview()
 {
     //Arrange
     $beer_id = 1;
     $user_id = 1;
     $review = "Great beer";
     $date = "2015-10-08";
     $id = 3;
     $test_review = new Review($beer_id, $user_id, $review, $date, $id);
     $test_review->save();
     $beer_id = 2;
     $user_id = 2;
     $review = "Bad beer";
     $date = "2015-10-09";
     $id = 3;
     $test_review2 = new Review($beer_id, $user_id, $review, $date, $id);
     $test_review2->save();
     //Act
     $search_beer_id = $test_review2->getBeerId();
     $search_user_id = $test_review2->getUserId();
     $result = Review::findReview($search_beer_id, $search_user_id);
     //Assert
     $this->assertEquals([$test_review2], $result);
 }
開發者ID:bborealis,項目名稱:growler,代碼行數:24,代碼來源:ReviewTest.php

示例4: array

    $user = User::find("id", $user_id);
    $store = Store::find("id", $store_id);
    return $app['twig']->render('store.html.twig', array('store' => $store[0], 'user' => $user[0], 'beers' => $store[0]->getBeers(), 'all_beers' => Beer::getAll()));
});
//from store
//add beer to store
//show store
$app->post("/{user_id}/store/{store_id}", function ($user_id, $store_id) use($app) {
    $store = Store::find("id", $store_id);
    $beer = Beer::find("id", $_POST['beer_id']);
    $store[0]->addBeer($beer[0]->getId());
    $user = User::find("id", $user_id);
    return $app['twig']->render('store.html.twig', array('store' => $store[0], 'user' => $user[0], 'beers' => $store[0]->getBeers(), 'all_beers' => Beer::getAll()));
});
//--------------------------------------------- Begin Review Functionality ----------------------------------------
$app->get("/{user_id}/review/{beer_id}", function ($user_id, $beer_id) use($app) {
    $user = User::find("id", $user_id);
    $beer = Beer::find("id", $beer_id);
    return $app['twig']->render('review.html.twig', array('user' => $user[0], 'beer' => $beer[0]));
});
$app->post("/{user_id}/review/{beer_id}", function ($user_id, $beer_id) use($app) {
    $user = User::find("id", $user_id);
    $review = Review::findReview($beer_id, $user_id);
    $review[0]->update($_POST['beer_review'], $_POST['review_date']);
    $reviews = Review::find("user_id", $user[0]->getId());
    $new_beers = User::findBeerStyle($user[0]->getId(), $user[0]->getPreferredStyle());
    $local_stores = Store::find("region", $user[0]->getRegion());
    return $app['twig']->render('profile.html.twig', array('user' => $user[0], 'reviews' => $reviews, 'new_beers' => $new_beers, 'local_stores' => $local_stores));
});
return $app;
//End of app, do not code below here
開發者ID:bborealis,項目名稱:growler,代碼行數:31,代碼來源:app.php


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