Exemplo n.º 1
0
 /**
  * @param $result
  * @return IHolder
  */
 public function populate($result)
 {
     $holder = new \App\Holder\Results\Base\Question();
     if (isset($result["question_id_question"])) {
         $holder->setQuestion(Service::populateEntity($result, \App\Model\Question::getClassName(), "question"));
     }
     if (isset($result["subquestion_id_subquestion"])) {
         $holder->setSubquestion(Service::populateEntity($result, \App\Model\Subquestion::getClassName(), "subquestion"));
     }
     if (isset($result["page_id_page"])) {
         $holder->setPage(Service::populateEntity($result, \App\Model\Page::getClassName(), "page"));
     }
     if (isset($result["website_id_website"])) {
         $holder->setWebsite(Service::populateEntity($result, \App\Model\Website::getClassName(), "website"));
     }
     if (isset($result["respondent_id_respondent"])) {
         $holder->setRespondent(Service::populateEntity($result, \App\Model\Respondent::getClassName(), "respondent"));
     }
     if (isset($result["respondentwebsite_id_respondent_website"])) {
         $holder->setRespondentWebsite(Service::populateEntity($result, \App\Model\RespondentWebsite::getClassName(), "respondentwebsite"));
     }
     return $holder;
 }
Exemplo n.º 2
0
 /**
  * @param \App\Filter\Results\Subquestions $filter
  * @return \App\Holder\Results\Base\Question[]
  */
 public function getResultsSubquestion($filter = null)
 {
     $query = $this->entityManager->getRepository($this->repositoryName)->createQueryBuilder();
     $query->select("subquestion");
     $query->addSelect("question");
     $query->from(Model\Subquestion::getClassName(), "subquestion");
     $query->join(Model\Question::getClassName(), "question", Join::WITH, "subquestion.id_question = question.id_question")->addSelect("question");
     $query->join(Model\Page::getClassName(), "page", Join::WITH, "question.id_page = page.id_page")->addSelect("page");
     $query->join(Model\Website::getClassName(), "website", Join::WITH, "page.id_website = website.id_website")->addSelect("website");
     $query->join(Model\Respondent::getClassName(), "respondent", Join::WITH, "question.id_respondent = respondent.id_respondent")->addSelect("respondent");
     $query->leftJoin(Model\RespondentWebsite::getClassName(), "respondentwebsite", Join::WITH, $query->expr()->andX($query->expr()->eq('respondent.id_respondent', 'respondentwebsite.id_respondent'), $query->expr()->eq('website.id_website', 'respondentwebsite.id_website')))->addSelect("respondentwebsite");
     if ($filter !== null) {
         $this->createNumberCondition($filter->getIdRespondents(), $query, "respondent.id_respondent");
         $this->createNumberCondition($filter->getIdWireframe(), $query, "subquestion.id_wireframe");
         $this->createNumberCondition($filter->getSeconds(), $query, "subquestion.seconds");
         $this->createNumberCondition($filter->getTypes(), $query, "subquestion.question_type");
         $this->createNumberCondition($filter->getState(), $query, "subquestion.state");
         $this->createNumberCondition($filter->getKnowns(), $query, "respondentwebsite.period");
         $this->createNumberCondition($filter->getPages(), $query, "page.id_page");
         $this->createNumberCondition($filter->getWebsites(), $query, "website.id_website");
         $this->createNumberCondition($filter->getDatetimes(), $query, "subquestion.datetime");
         $this->createNumberCondition($filter->getIds(), $query, "subquestion.id_subquestion");
         $this->createNumberCondition($filter->getIdsQuestions(), $query, "question.id_question");
         $this->createStringCondition($filter->getAnswer(), $query, "subquestion.answer", "subquestion.answer");
         $this->createStringCondition($filter->getReason(), $query, "subquestion.reason", "subquestion.answer");
     }
     if (is_array($filter->getOrderBy()) && count($filter->getOrderBy()) > 0) {
         $this->createOrders($filter->getOrderBy(), $query);
     } else {
         $query->orderBy("subquestion.id_subquestion", "desc");
     }
     return $this->getHolders($query, new \App\Holder\Mapper\Results\Base\Question());
 }
 /**
  * @param EntityManager $entityManager
  */
 public function __construct(EntityManager $entityManager)
 {
     parent::__construct($entityManager, \App\Model\RespondentWebsite::getClassName());
 }