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