public static function map(BlogRestaurant $blogRestaurant, array $properties) { if (array_key_exists('restaurant_id', $properties)) { $blogRestaurant->setId($properties['restaurant_id']); } if (array_key_exists('name_of_restaurant', $properties)) { $blogRestaurant->setNameOfRestaurant($properties['name_of_restaurant']); } if (array_key_exists('overall_rating', $properties)) { $blogRestaurant->setOverallRating($properties['overall_rating']); } }
public function insert(BlogRestaurant $blogRestaurant) { //needs changing //$now = new DateTime(); $blogRestaurant->setId(null); //$flightBooking->setCreatedOn($now); //$flightBooking->setLastModifiedOn($now); $blogRestaurant->setStatus(SimpleBlogPost::PENDING); $sql = ' INSERT INTO blog_restaurant (name_of_restaurant, overall_rating) VALUES (:name_of_restaurant, :overall_rating)'; return $this->execute($sql, $blogRestaurant); }