/** * @param \ConsultBundle\Entity\DoctorQuestion $doctorQuestion */ public function __construct(DoctorQuestion $doctorQuestion) { parent::__construct($doctorQuestion->getQuestion()); $this->setId($doctorQuestion->getId()); $this->setState($doctorQuestion->getState()); //$this->images = $doctorQuestion->getQuestion()->getImages(); }
/** * @param \ConsultBundle\Entity\DoctorQuestion $doctorQuestion */ public function __construct(DoctorQuestion $doctorQuestion) { if (!empty($doctorQuestion)) { $question = $doctorQuestion->getQuestion(); parent::__construct($question); $this->setId($doctorQuestion->getId()); $this->setState($doctorQuestion->getState()); $this->setHasImages($question->getImages()->count()); $reply = $doctorQuestion->getDoctorReplies(); if (!empty($reply) && !$reply->isSoftDeleted()) { $rating = $doctorQuestion->getDoctorReplies()->getRating(); $this->setRating($rating); } } }