/** * @param \ConsultBundle\Entity\Question $questionEntity * @param $practoAccountId * @param \ConsultBundle\Response\DetailQuestionResponseObject $question * * @return \ConsultBundle\Response\DetailQuestionResponseObject|null * @throws \HttpException */ protected function fetchDetailQuestionObject(Question $questionEntity, $practoAccountId, DetailQuestionResponseObject $question = null) { if (!empty($questionEntity) && empty($question)) { if (!$questionEntity->getUserInfo()->isIsRelative()) { $this->userProfileUtil->retrieveUserProfileNew($questionEntity->getUserInfo()); } $question = new DetailQuestionResponseObject($questionEntity, $practoAccountId); } $this->fetchRepliesByQuestion($questionEntity, $question, $practoAccountId); $bookmarkCount = $this->helper->getRepository(ConsultConstants::QUESTION_ENTITY_NAME)->getBookmarkCountForAQuestion($questionEntity); $question->setBookmarkCount($bookmarkCount); $er = $this->helper->getRepository(ConsultConstants::QUESTION_BOOKMARK_ENTITY_NAME); //Set comments /** * @var QuestionCommentRepository $ecr */ $ecr = $this->helper->getRepository(ConsultConstants::QUESTION_COMMENT_ENTITY_NAME); $questionCommentList = $ecr->getComments($questionEntity, 10, 0, $practoAccountId); $question->setComments($questionCommentList); if (!empty($practoAccountId)) { $bookmark = $er->findOneBy(array("practoAccountId" => $practoAccountId, "question" => $questionEntity, "softDeleted" => 0)); if (!empty($bookmark)) { $question->setIsBookmarked(true); } } return $question; }
/** * @param \ConsultBundle\Entity\Question $question */ public function loadUserDetailInQuestion(Question $question) { $userInfo = $question->getUserInfo(); if (!$userInfo->isIsRelative()) { $userInfo = $this->retrieveUserProfileNew($userInfo); $question->setUserInfo($userInfo); } }