本文整理汇总了PHP中Review::setReviewId方法的典型用法代码示例。如果您正苦于以下问题:PHP Review::setReviewId方法的具体用法?PHP Review::setReviewId怎么用?PHP Review::setReviewId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Review
的用法示例。
在下文中一共展示了Review::setReviewId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateReview
public static function updateReview()
{
// Process updating review
$reviews = ReviewsDB::getReviewsBy('reviewId', $_SESSION['arguments']);
if (empty($reviews)) {
HomeView::show();
header('Location: /' . $_SESSION['base']);
} elseif ($_SERVER["REQUEST_METHOD"] == "GET") {
$_SESSION['reviews'] = $reviews;
ReviewView::showUpdate();
} else {
$parms = $reviews[0]->getParameters();
$parms['score'] = array_key_exists('score', $_POST) ? $_POST['score'] : $reviews[0]->getScore();
$parms['review'] = array_key_exists('review', $_POST) ? $_POST['review'] : $reviews[0]->getReview();
$newReview = new Review($parms);
$newReview->setReviewId($reviews[0]->getReviewId());
$review = ReviewsDB::updateReview($newReview);
if ($review->getErrorCount() != 0) {
$_SESSION['reviews'] = array($newReview);
ReviewView::showUpdate();
} else {
HomeView::show();
header('Location: /' . $_SESSION['base']);
}
}
}
示例2: getReviewsArray
public static function getReviewsArray($rowSets)
{
// Return an array of Review objects extracted from $rowSets
$reviews = array();
foreach ($rowSets as $reviewRow) {
$review = new Review($reviewRow);
$review->setReviewId($reviewRow['reviewId']);
array_push($reviews, $review);
}
return $reviews;
}
示例3: testUpdateReview
public function testUpdateReview()
{
$myDb = DBMaker::create('ptest');
Database::clearDB();
$db = Database::getDB('ptest', 'C:\\xampp\\myConfig.ini');
$beforeCount = count(ReviewsDB::getReviewsBy());
$reviews = ReviewsDB::getReviewsBy('reviewId', 1);
$currentReview = $reviews[0];
$parms = $currentReview->getParameters();
$parms['review'] = 'new review text';
$newReview = new Review($parms);
$newReview->setReviewId($currentReview->getReviewId());
$updatedReview = ReviewsDB::updateReview($newReview);
$afterCount = count(ReviewsDB::getReviewsBy());
$this->assertEquals($beforeCount, $afterCount, 'The number of reviews in the database should not change after update');
$this->assertEquals($updatedReview->getReviewId(), $newReview->getReviewId(), 'The id of the updated review should remain the same');
}
示例4: array
<?php
$input = array("reviewerName" => "Kay", "submissionID" => 2, "score" => "5", "review" => "This was a great presentation");
$theReview = new Review($input);
echo "The review {$theReview}";
echo "The reviewer name is " . $theReview->getReviewerName() . "<br>";
$_SESSION = array('reviews' => array($theReview), 'base' => "mvcdbcrud");
ReviewView::show();
?>
<h2>It should show display the review form with errors at the top if invalid entry</h2>
<?php
$input = array("reviewerName" => "Kay#");
$theReview = new Review($input);
echo "The review {$theReview}";
echo "The reviewer name is " . $theReview->getReviewerName() . "<br>";
$_SESSION = array('reviews' => array($theReview), 'base' => "mvcdbcrud");
ReviewView::show();
?>
<h2>It should allow updating when a valid review is passed</h2>
<?php
$validTest = array("reviewerName" => "Kay", "submissionId" => 2, "score" => "5", "review" => "This was a great presentation");
$review = new Review($validTest);
$review->setReviewId(1);
echo $review;
$_SESSION = array('reviews' => array($review), 'base' => "mvcdbcrud");
ReviewView::showUpdate();
?>
</body>
</html>
示例5: count
echo "Now the database has {$afterCount}<br>";
?>
<h2>It should all update of a valid review</h2>
<?php
DBMaker::create('ptest');
Database::clearDB();
$db = Database::getDB('ptest', 'C:\\xampp\\myConfig.ini');
$beforeCount = count(ReviewsDB::getReviewsBy());
$reviews = ReviewsDB::getReviewsBy('reviewId', 1);
$currentReview = $reviews[0];
echo "Current review: {$currentReview}<br>";
$parms = $currentReview->getParameters();
$parms['review'] = 'new review text';
$newReview = new Review($parms);
$newReview->setReviewId($currentReview->getReviewId());
$updatedReview = ReviewsDB::updateReview($newReview);
echo "Updated review: {$updatedReview}<br>";
$afterCount = count(ReviewsDB::getReviewsBy());
echo "<br>Count before update = {$beforeCount}<br>";
echo "Count after = {$afterCount}<br>";
?>
<h2>It should get a review by reviewer name</h2>
<?php
DBMaker::create('ptest');
Database::clearDB();
$db = Database::getDB('ptest', 'C:\\xampp\\myConfig.ini');
$reviews = ReviewsDB::getReviewsBy('reviewerName', 'Alice');
echo "<br>Number of reviews by Alice is " . count($reviews);
foreach ($reviews as $review) {