/** * Converts the media item fetched from the database to the MediaItem object. */ private function convertMediaItem($row) { $mediaItem = new MediaItem($row['mime_type'], $row['type'], $row['url']); $mediaItem->setId($row['id']); $mediaItem->setAlbumId($row['album_id']); $mediaItem->setFileSize($row['file_size']); $mediaItem->setDuration($row['duration']); $mediaItem->setCreated($row['created']); $mediaItem->setLastUpdated($row['last_updated']); $mediaItem->setLanguage($row['language']); $mediaItem->setNumComments($row['num_comments']); $mediaItem->setNumViews($row['num_views']); $mediaItem->setNumVotes($row['num_votes']); $mediaItem->setRating($row['rating']); $mediaItem->setStartTime($row['start_time']); $mediaItem->setTitle($row['title']); $mediaItem->setDescription($row['description']); $mediaItem->setTaggedPeople(json_decode($row['tagged_people'])); $mediaItem->setTags(json_decode($row['tags'])); $mediaItem->setThumbnailUrl($row['thumbnail_url']); if (isset($row['address_id'])) { $mediaItem->setLocation($this->getAddress($row['address_id'])); } return $mediaItem; }