Exemple #1
0
 /**
  * @param \ConsultBundle\Entity\Question                       $questionEntity
  * @param \ConsultBundle\Response\DetailQuestionResponseObject $question
  *
  * @throws \HttpException
  */
 protected function fetchRepliesByQuestion(Question $questionEntity, DetailQuestionResponseObject $question, $practoAccountId = 0)
 {
     /**
      * @var DoctorQuestionRepository $er
      */
     $er = $this->helper->getRepository(ConsultConstants::DOCTOR_QUESTION_ENTITY_NAME);
     $doctorQuestions = $er->findRepliesByQuestion($questionEntity, $practoAccountId);
     $replies = array();
     foreach ($doctorQuestions as $doctorQuestion) {
         $reply = new ReplyResponseObject();
         $reply->setAttributes($doctorQuestion);
         $reply->setDoctorFromAttributes($doctorQuestion);
         $replies[] = $reply;
     }
     $question->setReplies($replies);
 }
 /**
  * @param int $id
  * @param int $practoAccountId
  *
  * @return \ConsultBundle\Response\ReplyResponseObject
  * @throws \HttpException
  */
 public function getReplyById($id, $practoAccountId = 0)
 {
     if (empty($id)) {
         return null;
     }
     if (empty($practoAccountId)) {
         $practoAccountId = $_SESSION['authenticated_user']['id'];
     }
     $reply = new ReplyResponseObject();
     /**
      * @var DoctorQuestionRepository $er
      */
     $er = $this->helper->getRepository(ConsultConstants::DOCTOR_QUESTION_ENTITY_NAME);
     $replyArray = $er->findReplyById($id, $practoAccountId);
     if (count($replyArray) == 0 || count($replyArray) > 1) {
         throw new HttpException("Invalid Reply Id", Codes::HTTP_BAD_REQUEST);
     }
     $reply->setAttributes($replyArray[0]);
     $reply->setDoctorFromAttributes($replyArray[0]);
     return $reply;
 }