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


PHP Review::getId方法代码示例

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


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

示例1: Cuisine

 function test_getId()
 {
     //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->getId();
     $this->assertEquals(true, is_numeric($result));
 }
开发者ID:Camolot,项目名称:restaurants,代码行数:25,代码来源:ReviewTest.php

示例2: Restaurant

 function test_getId()
 {
     $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->getId();
     $this->assertEquals($id, $result);
 }
开发者ID:jeffaustin81,项目名称:Restaurants,代码行数:13,代码来源:ReviewTest.php

示例3: Cuisine

 function test_getId()
 {
     $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();
     $user = "yoloswag1959";
     $stars = 3;
     $headline = "It's aight.";
     $body = "Yeah, pretty aight bro";
     $restaurant_id = $test_restaurant->getId();
     $test_review = new Review($user, $stars, $headline, $body, $restaurant_id);
     $test_review->save();
     $result = $test_review->getId();
     $this->assertEquals(true, is_numeric($result));
 }
开发者ID:juliocesardiaz,项目名称:Best-restaurants,代码行数:23,代码来源:ReviewTest.php

示例4: testScenarioUsingQuery

 public function testScenarioUsingQuery()
 {
     // Add publisher records
     // ---------------------
     try {
         $scholastic = new Publisher();
         $scholastic->setName("Scholastic");
         // do not save, will do later to test cascade
         $morrow = new Publisher();
         $morrow->setName("William Morrow");
         $morrow->save();
         $morrow_id = $morrow->getId();
         $penguin = new Publisher();
         $penguin->setName("Penguin");
         $penguin->save();
         $penguin_id = $penguin->getId();
         $vintage = new Publisher();
         $vintage->setName("Vintage");
         $vintage->save();
         $vintage_id = $vintage->getId();
         $this->assertTrue(true, 'Save Publisher records');
     } catch (Exception $e) {
         $this->fail('Save publisher records');
     }
     // Add author records
     // ------------------
     try {
         $rowling = new Author();
         $rowling->setFirstName("J.K.");
         $rowling->setLastName("Rowling");
         // do not save, will do later to test cascade
         $stephenson = new Author();
         $stephenson->setFirstName("Neal");
         $stephenson->setLastName("Stephenson");
         $stephenson->save();
         $stephenson_id = $stephenson->getId();
         $byron = new Author();
         $byron->setFirstName("George");
         $byron->setLastName("Byron");
         $byron->save();
         $byron_id = $byron->getId();
         $grass = new Author();
         $grass->setFirstName("Gunter");
         $grass->setLastName("Grass");
         $grass->save();
         $grass_id = $grass->getId();
         $this->assertTrue(true, 'Save Author records');
     } catch (Exception $e) {
         $this->fail('Save Author records');
     }
     // Add book records
     // ----------------
     try {
         $phoenix = new Book();
         $phoenix->setTitle("Harry Potter and the Order of the Phoenix");
         $phoenix->setISBN("043935806X");
         $phoenix->setAuthor($rowling);
         $phoenix->setPublisher($scholastic);
         $phoenix->save();
         $phoenix_id = $phoenix->getId();
         $this->assertFalse($rowling->isNew(), 'saving book also saves related author');
         $this->assertFalse($scholastic->isNew(), 'saving book also saves related publisher');
         $qs = new Book();
         $qs->setISBN("0380977427");
         $qs->setTitle("Quicksilver");
         $qs->setAuthor($stephenson);
         $qs->setPublisher($morrow);
         $qs->save();
         $qs_id = $qs->getId();
         $dj = new Book();
         $dj->setISBN("0140422161");
         $dj->setTitle("Don Juan");
         $dj->setAuthor($byron);
         $dj->setPublisher($penguin);
         $dj->save();
         $dj_id = $qs->getId();
         $td = new Book();
         $td->setISBN("067972575X");
         $td->setTitle("The Tin Drum");
         $td->setAuthor($grass);
         $td->setPublisher($vintage);
         $td->save();
         $td_id = $td->getId();
         $this->assertTrue(true, 'Save Book records');
     } catch (Exception $e) {
         $this->fail('Save Author records');
     }
     // Add review records
     // ------------------
     try {
         $r1 = new Review();
         $r1->setBook($phoenix);
         $r1->setReviewedBy("Washington Post");
         $r1->setRecommended(true);
         $r1->setReviewDate(time());
         $r1->save();
         $r1_id = $r1->getId();
         $r2 = new Review();
         $r2->setBook($phoenix);
         $r2->setReviewedBy("New York Times");
//.........这里部分代码省略.........
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:101,代码来源:BookstoreTest.php

示例5: catch

    print "Added book \"The Tin Drum\" [id = {$dj_id}].\n";
} catch (Exception $e) {
    die("Error saving book: " . $e->__toString());
}
// Add review records
// ------------------
try {
    print "\nAdding some book reviews to the list\n";
    print "------------------------------------\n\n";
    $r1 = new Review();
    $r1->setBook($phoenix);
    $r1->setReviewedBy("Washington Post");
    $r1->setRecommended(true);
    $r1->setReviewDate(time());
    $r1->save();
    $r1_id = $r1->getId();
    print "Added Washington Post book review  [id = {$r1_id}].\n";
    $r2 = new Review();
    $r2->setBook($phoenix);
    $r2->setReviewedBy("New York Times");
    $r2->setRecommended(false);
    $r2->setReviewDate(time());
    $r2->save();
    $r2_id = $r2->getId();
    print "Added New York Times book review  [id = {$r2_id}].\n";
} catch (Exception $e) {
    die("Error saving book review: " . $e->__toString());
}
// Perform a "complex" search
// --------------------------
try {
开发者ID:yasirgit,项目名称:afids,代码行数:31,代码来源:bookstore-test.php

示例6: testTypeSensitive

 /**
  * Test the type sensitivity of the resturning columns.
  *
  */
 public function testTypeSensitive()
 {
     $book = BookPeer::doSelectOne(new Criteria());
     $r = new Review();
     $r->setReviewedBy("testTypeSensitive Tester");
     $r->setReviewDate(time());
     $r->setBook($book);
     $r->setRecommended(true);
     $r->save();
     $id = $r->getId();
     unset($r);
     // clear the instance cache to force reload from database.
     ReviewPeer::clearInstancePool();
     BookPeer::clearInstancePool();
     // reload and verify that the types are the same
     $r2 = ReviewPeer::retrieveByPK($id);
     $this->assertType('integer', $r2->getId(), "Expected getId() to return an integer.");
     $this->assertType('string', $r2->getReviewedBy(), "Expected getReviewedBy() to return a string.");
     $this->assertType('boolean', $r2->getRecommended(), "Expected getRecommended() to return a boolean.");
     $this->assertType('Book', $r2->getBook(), "Expected getBook() to return a Book.");
     $this->assertType('float', $r2->getBook()->getPrice(), "Expected Book->getPrice() to return a float.");
     $this->assertType('DateTime', $r2->getReviewDate(null), "Expected Book->getReviewDate() to return a DateTime.");
 }
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:27,代码来源:GeneratedObjectTest.php

示例7: Bathroom

 function test_getReviews()
 {
     $unisex = 0;
     $key_required = 0;
     $public = 0;
     $handicap = 0;
     $changing_table = 0;
     $marker_id = 2;
     $test_bathroom = new Bathroom($unisex, $key_required, $public, $handicap, $changing_table, $marker_id);
     $test_bathroom->save();
     $rating = 1;
     $comment = "This place sucks!";
     $test_review = new Review($rating, $comment);
     $test_review->save();
     $rating2 = 3;
     $comment2 = "Its aight!";
     $test_review2 = new Review($rating2, $comment2);
     $test_review2->save();
     $test_bathroom->addReview($test_review->getId());
     $test_bathroom->addReview($test_review2->getId());
     $result = $test_bathroom->getReviews();
     $this->assertEquals([$test_review, $test_review2], $result);
 }
开发者ID:jeffaustin81,项目名称:tinklr-dev,代码行数:23,代码来源:BathroomTest.php

示例8: setReview

 /**
  * Declares an association between this object and a Review object.
  *
  * @param      Review $v
  * @return     Model The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setReview(Review $v = null)
 {
     if ($v === null) {
         $this->setReviewId(NULL);
     } else {
         $this->setReviewId($v->getId());
     }
     $this->aReview = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Review object, it will not be re-added.
     if ($v !== null) {
         $v->addModel($this);
     }
     return $this;
 }
开发者ID:navid045,项目名称:maxlaptop,代码行数:22,代码来源:BaseModel.php

示例9: Review

 function test_getId()
 {
     //Arrange
     $beer_id = 1;
     $user_id = 1;
     $review = "Great beer";
     $date = "2015-10-08";
     $id = 1;
     $test_review = new Review($beer_id, $user_id, $review, $date, $id);
     $test_review->save();
     //Act
     $test = true;
     $result = is_numeric($test_review->getId());
     //Assert
     $this->assertEquals($test, $result);
 }
开发者ID:bborealis,项目名称:growler,代码行数:16,代码来源:ReviewTest.php

示例10: testSpeed

 public function testSpeed()
 {
     // Add publisher records
     // ---------------------
     $scholastic = new Publisher();
     $scholastic->setName("Scholastic");
     // do not save, will do later to test cascade
     $morrow = new Publisher();
     $morrow->setName("William Morrow");
     $morrow->save();
     $morrow_id = $morrow->getId();
     $penguin = new Publisher();
     $penguin->setName("Penguin");
     $penguin->save();
     $penguin_id = $penguin->getId();
     $vintage = new Publisher();
     $vintage->setName("Vintage");
     $vintage->save();
     $vintage_id = $vintage->getId();
     // Add author records
     // ------------------
     $rowling = new Author();
     $rowling->setFirstName("J.K.");
     $rowling->setLastName("Rowling");
     // no save()
     $stephenson = new Author();
     $stephenson->setFirstName("Neal");
     $stephenson->setLastName("Stephenson");
     $stephenson->save();
     $stephenson_id = $stephenson->getId();
     $byron = new Author();
     $byron->setFirstName("George");
     $byron->setLastName("Byron");
     $byron->save();
     $byron_id = $byron->getId();
     $grass = new Author();
     $grass->setFirstName("Gunter");
     $grass->setLastName("Grass");
     $grass->save();
     $grass_id = $grass->getId();
     // Add book records
     // ----------------
     $phoenix = new Book();
     $phoenix->setTitle("Harry Potter and the Order of the Phoenix");
     $phoenix->setISBN("043935806X");
     // cascading save (Harry Potter)
     $phoenix->setAuthor($rowling);
     $phoenix->setPublisher($scholastic);
     $phoenix->save();
     $phoenix_id = $phoenix->getId();
     $qs = new Book();
     $qs->setISBN("0380977427");
     $qs->setTitle("Quicksilver");
     $qs->setAuthor($stephenson);
     $qs->setPublisher($morrow);
     $qs->save();
     $qs_id = $qs->getId();
     $dj = new Book();
     $dj->setISBN("0140422161");
     $dj->setTitle("Don Juan");
     $dj->setAuthor($byron);
     $dj->setPublisher($penguin);
     $dj->save();
     $dj_id = $qs->getId();
     $td = new Book();
     $td->setISBN("067972575X");
     $td->setTitle("The Tin Drum");
     $td->setAuthor($grass);
     $td->setPublisher($vintage);
     $td->save();
     $td_id = $td->getId();
     // Add review records
     // ------------------
     $r1 = new Review();
     $r1->setBook($phoenix);
     $r1->setReviewedBy("Washington Post");
     $r1->setRecommended(true);
     $r1->setReviewDate(time());
     $r1->save();
     $r1_id = $r1->getId();
     $r2 = new Review();
     $r2->setBook($phoenix);
     $r2->setReviewedBy("New York Times");
     $r2->setRecommended(false);
     $r2->setReviewDate(time());
     $r2->save();
     $r2_id = $r2->getId();
     // Perform a "complex" search
     // --------------------------
     $crit = new Criteria();
     $crit->add(BookPeer::TITLE, 'Harry%', Criteria::LIKE);
     $results = BookPeer::doSelect($crit);
     $crit2 = new Criteria();
     $crit2->add(BookPeer::ISBN, array("0380977427", "0140422161"), Criteria::IN);
     $results = BookPeer::doSelect($crit2);
     // Perform a "limit" search
     // ------------------------
     $crit = new Criteria();
     $crit->setLimit(2);
     $crit->setOffset(1);
//.........这里部分代码省略.........
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:101,代码来源:speed.php

示例11: populate

 public static function populate($con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     }
     $con->beginTransaction();
     // Add publisher records
     // ---------------------
     $scholastic = new Publisher();
     $scholastic->setName("Scholastic");
     // do not save, will do later to test cascade
     $morrow = new Publisher();
     $morrow->setName("William Morrow");
     $morrow->save($con);
     $morrow_id = $morrow->getId();
     $penguin = new Publisher();
     $penguin->setName("Penguin");
     $penguin->save();
     $penguin_id = $penguin->getId();
     $vintage = new Publisher();
     $vintage->setName("Vintage");
     $vintage->save($con);
     $vintage_id = $vintage->getId();
     $rowling = new Author();
     $rowling->setFirstName("J.K.");
     $rowling->setLastName("Rowling");
     // no save()
     $stephenson = new Author();
     $stephenson->setFirstName("Neal");
     $stephenson->setLastName("Stephenson");
     $stephenson->save($con);
     $stephenson_id = $stephenson->getId();
     $byron = new Author();
     $byron->setFirstName("George");
     $byron->setLastName("Byron");
     $byron->save($con);
     $byron_id = $byron->getId();
     $grass = new Author();
     $grass->setFirstName("Gunter");
     $grass->setLastName("Grass");
     $grass->save($con);
     $grass_id = $grass->getId();
     $phoenix = new Book();
     $phoenix->setTitle("Harry Potter and the Order of the Phoenix");
     $phoenix->setISBN("043935806X");
     $phoenix->setAuthor($rowling);
     $phoenix->setPublisher($scholastic);
     $phoenix->setPrice(10.99);
     $phoenix->save($con);
     $phoenix_id = $phoenix->getId();
     $qs = new Book();
     $qs->setISBN("0380977427");
     $qs->setTitle("Quicksilver");
     $qs->setPrice(11.99);
     $qs->setAuthor($stephenson);
     $qs->setPublisher($morrow);
     $qs->save($con);
     $qs_id = $qs->getId();
     $dj = new Book();
     $dj->setISBN("0140422161");
     $dj->setTitle("Don Juan");
     $dj->setPrice(12.99);
     $dj->setAuthor($byron);
     $dj->setPublisher($penguin);
     $dj->save($con);
     $dj_id = $dj->getId();
     $td = new Book();
     $td->setISBN("067972575X");
     $td->setTitle("The Tin Drum");
     $td->setPrice(13.99);
     $td->setAuthor($grass);
     $td->setPublisher($vintage);
     $td->save($con);
     $td_id = $td->getId();
     $r1 = new Review();
     $r1->setBook($phoenix);
     $r1->setReviewedBy("Washington Post");
     $r1->setRecommended(true);
     $r1->setReviewDate(time());
     $r1->save($con);
     $r1_id = $r1->getId();
     $r2 = new Review();
     $r2->setBook($phoenix);
     $r2->setReviewedBy("New York Times");
     $r2->setRecommended(false);
     $r2->setReviewDate(time());
     $r2->save($con);
     $r2_id = $r2->getId();
     $blob_path = _LOB_SAMPLE_FILE_PATH . '/tin_drum.gif';
     $clob_path = _LOB_SAMPLE_FILE_PATH . '/tin_drum.txt';
     $m1 = new Media();
     $m1->setBook($td);
     $m1->setCoverImage(file_get_contents($blob_path));
     // CLOB is broken in PDO OCI, see http://pecl.php.net/bugs/bug.php?id=7943
     if (get_class(Propel::getDB()) != "DBOracle") {
         $m1->setExcerpt(file_get_contents($clob_path));
     }
     $m1->save($con);
     // Add book list records
     // ---------------------
//.........这里部分代码省略.........
开发者ID:pkdevbox,项目名称:mootools-forge,代码行数:101,代码来源:BookstoreDataPopulator.php

示例12: Review

 function test_find()
 {
     //Arrange
     $rating = 1;
     $comment = "This place sucks!";
     $id = null;
     $test_review = new Review($rating, $comment, $id);
     $test_review->save();
     $rating2 = 2;
     $comment2 = "This place smells!";
     $id2 = null;
     $test_review2 = new Review($rating2, $comment2, $id2);
     $test_review2->save();
     //Act
     $result = Review::find($test_review2->getId());
     //Assert
     $this->assertEquals($test_review2, $result);
 }
开发者ID:jeffaustin81,项目名称:tinklr-dev,代码行数:18,代码来源:ReviewTest.php

示例13: addInstanceToPool

 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Review $value A Review object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Review $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
开发者ID:navid045,项目名称:maxlaptop,代码行数:22,代码来源:BaseReviewPeer.php

示例14: Bathroom

    $marker_id = $marker->getId();
    $bathroom = new Bathroom($unisex, $key_required, $public, $handicap, $changing_table, $marker_id);
    $bathroom->save();
    return $app['twig']->render('add_bathroom.html.twig', array('bathrooms' => Bathroom::getAll(), 'markers' => Marker::getAll(), 'form_check' => false));
});
$app->get('/bathroom/{id}', function ($id) use($app) {
    $bathroom = Bathroom::find($id);
    $marker = Marker::find($id);
    $reviews = Review::getReviewsForBathroom($bathroom);
    return $app['twig']->render('bathroom.html.twig', array('bathroom' => $bathroom, 'marker' => $marker, 'reviews' => $reviews));
});
// reviews
$app->get('/add_review/{id}', function ($id) use($app) {
    $marker = Marker::find($id);
    return $app['twig']->render('add_review.html.twig', array('marker' => $marker));
});
$app->post('/add_review/{id}', function ($id) use($app) {
    $review = $_POST['review'];
    $rating = $_POST['rating'];
    //get all the necessary objects
    $marker = Marker::find($id);
    $bathroom = Bathroom::find($marker->getId());
    //create new review obj
    $new_review = new Review($rating, $review);
    $new_review->save();
    $review_id = $new_review->getId();
    $bathroom->addReview($review_id);
    $reviews = Review::getReviewsForBathroom($bathroom);
    return $app['twig']->render('bathroom.html.twig', array('bathroom' => $bathroom, 'marker' => $marker, 'reviews' => $reviews));
});
return $app;
开发者ID:slmaturen,项目名称:tinklr-dev,代码行数:31,代码来源:app.php


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