public function populateReviews($reviewData) { foreach ($reviewData as $reviewItem) { $review = new Review(); $review->setCustomerFirstName($reviewItem['customer_name']); $review->setCustomerLastName($reviewItem['customer_last_name']); $submissionDate = date_create($reviewItem['date_of_submission']); $review->setSubmissionDate(date_format($submissionDate, "M jS, y")); $review->setCustomerReview($reviewItem['description']); $review->setRating($reviewItem['rating']); $review->setReviewFrom($reviewItem['review_from']); $review->setCustomerURL($reviewItem['customer_url']); $review->setReviewSource($reviewItem['review_source']); $review->setReviewURL($reviewItem['review_url']); $review->setReviewID($reviewItem['review_id']); $this->_reviews[] = $review; } //echo 'Review<pre>'; print_r($reviewData); echo '</pre>'; }
public function castToReview($obj) { $r = new Review(); if (isset($obj->reviewID)) { $r->setReviewID($obj->reviewID); } if (isset($obj->partID)) { $r->setPartID($obj->partID); } if (isset($obj->rating)) { $r->setRating($obj->rating); } if (isset($obj->subject)) { $r->setSubject($obj->subject); } if (isset($obj->review_text)) { $r->setReview_text($obj->review_text); } if (isset($obj->name)) { $r->setName($obj->name); } if (isset($obj->email)) { $r->setEmail($obj->email); } if (isset($obj->createdDate)) { $r->setCreateDate($obj->createdDate); } return $r; }