/** * @param MediaItem * @return MediaItem */ public function createMediaItem(MediaItem $video) { $statement = $this->_dbCon->query('INSERT INTO `video` (?,?,?,?,?,?,?,?,?,?)', array(null, $video->getTitle(), $video->getLink(), $video->getThumbsUp(), $video->getThumbsDown(), $video->getChannelId(), $video->getChannelTitle(), $video->getThumbnail(), $video->getDescription(), $video->getDuration())); $driver = $this->_dbCon->getDriver(); $video->setId($driver->getLastGeneratedValue()); return $video; }
public function convertMediaItemToArray(MediaItem $mediaItem) { return array("id" => $mediaItem->getLink(), "title" => $mediaItem->getTitle(), "description" => $mediaItem->getDescription(), "channelId" => $mediaItem->getChannelId(), "channelTitle" => $mediaItem->getChannelTitle(), "thumbnail" => $mediaItem->getThumbnail(), "duration" => $this->convertSecondsToTime($mediaItem->getDuration())); }