/**
  * @param Form $form
  */
 public function filterFormSubmited(Form $form)
 {
     $values = $form->getValues();
     if ($values->id_respondent) {
         $this->filter->setIdRespondents(Filter::createFilterArray($values->id_respondent));
     }
     if ($values->wireframe) {
         $this->filter->setIdWireframe(Filter::createFilterArray($values->wireframe));
     }
     if ($values->seconds) {
         $this->filter->setSeconds(Filter::createFilterArray($values->seconds));
     }
     if ($values->id) {
         $this->filter->setIds(Filter::createFilterArray($values->id));
     }
     if ($values->id_question) {
         $this->filter->setIdsQuestions(Filter::createFilterArray($values->id_question));
     }
     if ($values->datetime) {
         $this->filter->setDatetimes(Filter::createFilterArray($values->datetime));
     }
     if ($values->id_page) {
         $this->filter->setPages(Filter::createFilterArray($values->id_page));
     }
     if ($values->id_website) {
         $this->filter->setWebsites(Filter::createFilterArray($values->id_website));
     }
     if ($values->type) {
         $this->filter->setTypes(Filter::createFilterArray($values->type));
     }
     if ($values->state !== null) {
         $this->filter->setState(Filter::createFilterArray($values->state));
     }
     if ($values->answer) {
         $this->filter->setAnswer($values->answer);
     }
     if ($values->reason) {
         $this->filter->setReason($values->reason);
     }
     if ($values->know) {
         $this->filter->setKnowns(Filter::createFilterArray($values->know));
     }
     if ($values->order) {
         $order_arr = array();
         foreach ($values->order as $item) {
             if ($item->by && $item->dir) {
                 $order_arr[$item->by] = $item->dir;
             }
         }
         if (count($order_arr) > 0) {
             $this->filter->setOrderBy($order_arr);
         }
     }
     $this->redrawControl();
 }
Ejemplo 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());
 }