public static function validate(BlogRestaurant $blogRestaurant) { $errors = array(); if (!trim($blogRestaurant->getNameOfRestaurant())) { $errors[] = new Error('name_of_restaurant', 'Name of Restaurant cannot be empty.'); } return $errors; }
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']); } }
private function getParams(BlogRestaurant $blogRestaurant) { $params = array(':name_of_restaurant' => $blogRestaurant->getNameOfRestaurant(), ':overall_rating' => $blogRestaurant->getOverallRating()); // if ($flightBooking->getId()) { // // unset created date, this one is never updated // unset($params[':created_on']); // } return $params; }