/** * Instantiates a like entity and sets its properties using db data. * * @param array $likeData * The array of db data. * * @return \MusicBox\Entity\Like */ protected function buildLike($likeData) { // Load the related artist and user. $artist = $this->artistRepository->find($likeData['artist_id']); $user = $this->userRepository->find($likeData['user_id']); $like = new Like(); $like->setId($likeData['like_id']); $like->setArtist($artist); $like->setUser($user); $createdAt = new \DateTime('@' . $likeData['created_at']); $like->setCreatedAt($createdAt); return $like; }
/** * Instantiates a group entity and sets its properties using db data. * * @param array $groupData * The array of db data. * * @return \MusicBox\Entity\Like */ protected function buildGroup($groupData) { // Load the related lesson and host $lesson = $this->lessonRepository->find($groupData['lesson_id']); $host = $lesson->getHost(); $group = new Group(); $group->setId($groupData['group_id']); $group->setLesson($lesson); $group->setHost($host); $group->setCode($groupData['group_code']); $startsAt = new \DateTime('@' . $groupData['starts_at']); $group->setStartsAt($startsAt); return $group; }
/** * Instantiates a comment entity and sets its properties using db data. * * @param array $commentData * The array of db data. * * @return \MusicBox\Entity\Comment */ protected function buildComment($commentData) { // Load the related artist and user. $artist = $this->artistRepository->find($commentData['artist_id']); $user = $this->userRepository->find($commentData['user_id']); $comment = new Comment(); $comment->setId($commentData['comment_id']); $comment->setArtist($artist); $comment->setUser($user); $comment->setComment($commentData['comment']); $comment->setPublished($commentData['published']); $createdAt = new \DateTime('@' . $commentData['created_at']); $comment->setCreatedAt($createdAt); return $comment; }
/** * Instantiates a lesson entity and sets its properties using db data. * * @param array $lessonData * The array of db data. * * @return \MusicBox\Entity\Like */ protected function buildLesson($lessonData) { // Load the related lesson and host $host = $this->userRepository->find($lessonData['host_id']); $pool = $this->poolRepository->find($lessonData['pool_id']); $lesson = new Lesson(); $lesson->setId($lessonData['lesson_id']); // $lesson->setLesson($lesson); $lesson->setHost($host); $lesson->setPool($pool); $lesson->setTuition($lessonData['tuition']); $lesson->setDeposit($lessonData['deposit']); $lesson->setApproved($lessonData['approved']); $createdAt = new \DateTime('@' . $lessonData['created_at']); $lesson->setCreatedAt($createdAt); $updatedAt = new \DateTime('@' . $lessonData['updated_at']); $lesson->setUpdatedAt($updatedAt); return $lesson; }