/**
  * @param \App\Filter\Results\Respondents $filter
  * @return \App\Holder\Results\Base\Respondent[]
  */
 public function getResultsRespondent($filter = null)
 {
     $query = $this->entityManager->getRepository($this->repositoryName)->createQueryBuilder();
     $query->select("respondent");
     $query->addSelect("count(distinct question.id_question) as total_questions");
     $query->addSelect("count(distinct subquestion.id_subquestion) as total_subquestions");
     $query->addSelect("countif('state','=','1') as total_correct_subquestions");
     $query->addSelect("countif('state','=','0') as total_wrong_subquestions");
     $query->addSelect("countif('state','=','2') as total_almost_subquestions");
     $query->addSelect("countif('state','=','3') as total_disqualified_subquestions");
     $query->addSelect("countif('state','is','null') as total_unknown_subquestions");
     $query->addSelect("round((countif('state','=','1') / (countif('state','=','0') + countif('state','=','1') + countif('state','=','2')))*100,2) as total_correct_subquestions_percents");
     $query->from(Model\Respondent::getClassName(), "respondent");
     $query->leftJoin(Model\Question::getClassName(), "question", Join::WITH, "question.id_respondent = respondent.id_respondent");
     $query->leftJoin(Model\Subquestion::getClassName(), "subquestion", Join::WITH, "subquestion.id_question = question.id_question");
     if ($filter !== null) {
         $this->createNumberCondition($filter->getRespondents(), $query, "respondent.id_respondent");
         $this->createNumberCondition($filter->getPercentages(), $query, "round((countif('state','=','1') / (countif('state','=','0') + countif('state','=','1') + countif('state','=','2')))*100,2)", true);
         $this->createNumberCondition($filter->getQuestions(), $query, "count(distinct question.id_question)", true);
         $this->createNumberCondition($filter->getSubquestions(), $query, "count(distinct subquestion.id_subquestion)", true);
         $this->createNumberCondition($filter->getCorrects(), $query, "countif('state','=','1')", true);
         $this->createNumberCondition($filter->getWrongs(), $query, "countif('state','=','0')", true);
         $this->createNumberCondition($filter->getAlmosts(), $query, "countif('state','=','2')", true);
         $this->createNumberCondition($filter->getDisqualified(), $query, "countif('state','=','3')", true);
         $this->createNumberCondition($filter->getUnknowns(), $query, "countif('state','is','null')", true);
         $this->createNumberCondition($filter->getDatetimes(), $query, "date(respondent.datetime)");
         $this->createNumberCondition($filter->getAges(), $query, "respondent.age");
         $this->createNumberCondition($filter->getDevicesMost(), $query, "respondent.device_most");
         $this->createNumberCondition($filter->getGenders(), $query, "respondent.gender");
         $this->createNumberCondition($filter->getEnglishes(), $query, "respondent.english");
         $this->createNumberCondition($filter->getIts(), $query, "respondent.it");
         $this->createStringCondition($filter->getWebsites(), $query, "respondent.sites");
         if ($filter->getDevices() !== null) {
             $exprs = array();
             foreach ($filter->getDevices() as $device) {
                 switch ($device) {
                     case Model\Respondent::DEVICE_COMPUTER:
                         $exprs[] = "respondent.device_computer = 1";
                         break;
                     case Model\Respondent::DEVICE_PHONE:
                         $exprs[] = "respondent.device_phone = 1";
                         break;
                     case Model\Respondent::DEVICE_TABLET:
                         $exprs[] = "respondent.device_tablet = 1";
                         break;
                 }
             }
             if (count($exprs) > 0) {
                 $query->andWhere(implode(" or ", $exprs));
             }
         }
         if (is_array($filter->getOrderBy()) && count($filter->getOrderBy()) > 0) {
             $this->createOrders($filter->getOrderBy(), $query);
         } else {
             $query->orderBy("respondent.id_respondent", "desc");
         }
     }
     $query->groupBy("respondent.id_respondent");
     return $this->getHolders($query, new \App\Holder\Mapper\Results\Base\Respondent());
 }