/**
  * @param Form $form
  */
 public function personalFormSubmitted(Form $form)
 {
     $values = $form->getValues();
     $respondent = new \App\Model\Respondent();
     $respondent->gender = $values->gender;
     $respondent->age = $values->age;
     if ($values->english !== null) {
         $respondent->english = $values->english === 1;
     }
     if ($values->it !== null) {
         $respondent->it = $values->it === 1;
     }
     if (is_array($values->device)) {
         $respondent->device_phone = in_array(\App\Model\Respondent::DEVICE_PHONE, $values->device);
         $respondent->device_tablet = in_array(\App\Model\Respondent::DEVICE_TABLET, $values->device);
         $respondent->device_computer = in_array(\App\Model\Respondent::DEVICE_COMPUTER, $values->device);
     }
     $respondent->device_most = $values->device_most;
     $respondent->email = $values->email;
     $respondent->nickname = $values->nickname;
     $respondent->message = $values->message;
     $respondent->sites = $values->sites;
     $respondent->user_agent = $_SERVER["HTTP_USER_AGENT"];
     if (isset($values->code)) {
         $respondent->code = $values->code;
     }
     $this->respondent_service->save($respondent);
     foreach ($values->category as $category_id => $params) {
         $period = $params["period"];
         if ($period !== null) {
             $this->entity_category_service->addCategoryToRespondent($category_id, $respondent->id_respondent, $period);
         }
         if (array_key_exists("items", $params)) {
             foreach ($params->items as $item) {
                 $this->entity_category_service->addCategoryToRespondent($item, $respondent->id_respondent, \App\Model\EntityCategory::MOSTLY);
             }
         }
     }
     $this->sessionSection->id_respondent = $respondent->id_respondent;
     $this->sessionSection->code = null;
     $this->sessionSection->cannot_final = false;
     if ($this->sessionSection->id_question !== null) {
         $question = $this->question_service->get($this->sessionSection->id_question);
         $question->id_respondent = $respondent->id_respondent;
         $this->question_service->save($question);
     }
     $this->redirect("Survey:question");
 }