public static function map(SimpleBlogPost $blogPost, array $properties) { if (array_key_exists('blog_id', $properties)) { $blogPost->setId($properties['blog_id']); } if (array_key_exists('date', $properties)) { $formattedDate = $properties['date']; $date = self::createDateTime($formattedDate); if ($date) { $blogPost->setDate($date); } } if (array_key_exists('content', $properties)) { $blogPost->setContent($properties['content']); } if (array_key_exists('created_by', $properties)) { $blogPost->setCreatedBy($properties['created_by']); } if (array_key_exists('description', $properties)) { $blogPost->setDescription($properties['description']); } if (array_key_exists('modified_by', $properties)) { $blogPost->setModifiedBy($properties['modified_by']); } if (array_key_exists('name_of_restaurant', $properties)) { $blogPost->setNameOfRestaurant($properties['name_of_restaurant']); } if (array_key_exists('overall_rating', $properties)) { $blogPost->setOverallRating($properties['overall_rating']); } if (array_key_exists('restaurant_id', $properties)) { $blogPost->setRestaurantId($properties['restaurant_id']); } if (array_key_exists('username', $properties)) { $blogPost->setUsername($properties['username']); } }