Example #1
0
 /**
  * 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 pool entity and sets its properties using db data.
  *
  * @param array $poolData
  *   The array of db data.
  *
  * @return \MusicBox\Entity\Like
  */
 protected function buildPool($poolData)
 {
     // Load the related pool and host
     $address = $this->addressRepository->find($poolData['address_id']);
     // $pool = $this->poolRepository->find($poolData['pool_id']);
     $pool = new Pool();
     $pool->setPoolId($poolData['pool_id']);
     // $pool->setPool($pool);
     $pool->setAddress($address);
     // $pool->setFile($poolData['file']);
     $pool->setAccessinfo($poolData['access_info']);
     return $pool;
 }
 /**
  * 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;
 }