Stores the user input as a result object.

@param $form
@param $result
16626
public function storeResult(Form $form, Result $result)
    {
        $entityManager = $this->container->get('doctrine')->getManager();
        $form->addResult($result);
        $entityManager->persist($form);
        $entityManager->flush();
    }
339795
abstract function __construct($result, $buffered = true);

	/**
	 * Unserialize the SQLResultSet.
	 *
	 * @param string $data
	 *
	 * @return void
	 */

	public function unserialize($data){

		$this->_fetched = unserialize($data);
	}
847212
public function success(Form $form) : void
    {
        if ($this->presenter->isAjax())
        {
            $values = $form->getValues();

            try
            {
                $redirect = NULL;
                $page = $this->pageRepository->findOneById($values->pageId);

                if ($this->redirectId)
                {
                    $redirect = $this->onPageRepository->findOneRedirectById($this->redirectId);
                }

                $this->onPageManager->saveRedirect($redirect, $page, $values->oldUrl);

                $form->reset();

                $this->presenter->notificationAjax(
                    'URL přesměrována',
                    'URL byla úspěšně přesměrována.',
                    'success',
                    FALSE
                );

                $this->onSave();
            }
            catch (DatabaseException $exception)
            {
                $this->presenter->notificationAjax(
                    'Chyba',
                    $exception->getMessage(),
                    'error'
                );
            }
        }
    }
891779
public static function flash(string $name, $result) : void
    {
        $results = static::$_session->get("_RESULTS");

        $results[$name] = [
            "type"   => "flash",
            "result" => $result
        ];

        static::$_session->set("_RESULTS", $results);
    }
656857
protected function populatePreviousData(Form $form) {
		$prepops = EventAttendee::config()->prepopulated_fields;
		if (!$prepops) {
			return;
		}
		$latestattendee = $this->registration->Attendees()
			->sort("LastEdited", "DESC")->first();
		if($latestattendee){
			$form->loadDataFrom($latestattendee, Form::MERGE_DEFAULT, $prepops);	
		}
	}
590530
protected function processResult($result)
    {
        $output = Helper::objectToArray($result);

        if (! is_array($output)) {
            throw new Error\Api($output);
        }

        if (isset($output['result'])) {
            return $output;
        }

        if (
            isset($output['request']) &&
            $output['request']['result'] != 1 &&
            $output['request']['result'] !== 'TRUE') {
            throw new Error\Api($output['request']['errorId'] . ' - ' . $output['request']['errorMessage']);
        }

        return $output;
    }
398490
private function setTotalCount(ResultSet $result): void
    {
        $this->totalCount = $result->getTotalCount() - $this->startingOffset;
        $this->totalCount = $this->totalCount > 0 ? $this->totalCount : 0;

        if ($this->maxTotalCount !== null && $this->totalCount >= $this->maxTotalCount) {
            $this->totalCount = $this->maxTotalCount;
        }
    }
181009
protected function processFields(array $fields, array $results = [])
    {
        $input = $this->input;
        $output = $this->output;
        $helper = $this->helperSet->get('question');

        foreach ($fields as $field) {
            if (!$field instanceof FieldDefinitionInterface) {
                continue;
            }
            $field_name = $field->getName();

            if (isset($results[$field_name])) {
                continue;
            }

            if (!$field instanceof FieldGroup) {
                if ($field->hasCondition()
                    && !$this->fieldConditionMet($field, $results)) {
                    continue;
                }

                if ($field->hasFieldCallback()) {
                    $field->onFieldCallback($results);
                }

                if ($input->isInteractive()) {
                    try {
                        $value = $helper->ask($input, $output, $field->asQuestion());

                        if ($field->hasSubform()) {
                            $subform = new static();
                            $field->onSubformProcess($subform, $value);

                            $results[$field_name] = $subform
                                ->setInput($input)
                                ->setOutput($output)
                                ->setHelperSet($this->helperSet)
                                ->process()
                                ->getResults();
                        } else {
                            $results[$field_name] = $field->formattedValue($value);
                        }
                    } catch (\Exception $e) {
                        throw new FormException(trim($e->getMessage()));
                    }
                }
            } else {
                $groups = [];

                do {
                    $result = $this->processFields(
                        $field->getGroupFields()
                    );
                    $continue = false;

                    if ($field->hasLoopUntil()) {
                        $continue = $field->loopUntil([$result]);
                        if ($continue) {
                            $groups[] = $result;
                        }
                    } else {
                        $groups[] = $result;
                    }
                } while ($continue);

                $results[$field_name] = $groups;
            }
        }

        return $results;
    }
1123221
public function save(array $form, FormStateInterface $form_state) {
    $entity = $this->entity;
    $query = \Drupal::entityQuery('sport')->condition('name', '%'.$entity->get('name')->value.'%', 'LIKE');
    $id = $query->execute();

    if (count($id) == 0) {
      $status = $entity->save();
      if ($status) {
        drupal_set_message($this->t('Saved the %label Sport.', array(
          '%label' => $entity->label(),
        )));
      } else {
        drupal_set_message($this->t('The %label Sport was not saved.', array(
          '%label' => $entity->label(),
        )));
      }
    } else {
      drupal_set_message($this->t('The %label Sport was not saved as it already exist.', array(
        '%label' => $entity->label(),
      )));
      $entity = entity_load('sport', array_pop($id));
    }

    $form_state->setRedirect('entity.sport.edit_form', ['sport' => $entity->id()]);
  }
813635
protected function validateResult ($result) : bool
	{
		if (!is_string($result)) return TRUE;
		if (stripos($result, "An error") !== 0) return TRUE;
		$this->error = $result;
		return FALSE;
	}
1315659
public function setResult($result, $data = null)
    {
        if (null === $result) {
            return $this;
        }

        if (is_numeric($result)) {
            if ($result > 1000) {
                $result = ResultException::factory($result, $data);
            } else {
                $result = new static::$resultClass((int) $result, $data);
            }
        } elseif ($result instanceof ResultException) {
            // continue
        } elseif (is_array($result) && isset($result[self::RESULT_P_GLOBAL_CODE])) {
            $result = ResultException::factory($result[self::RESULT_P_GLOBAL_CODE], $result[self::RESULT_P_DATA]);
        } else {
            $result = new ResultException(ResultException::E_INTERNAL, $result);
        }

        if (!empty($data)) {
            $result->addData($data);
        }

        $this->result = $result;
        $this->setData(self::P_RESULT, [
            self::RESULT_P_GLOBAL_CODE => $result->getGlobalCode(),
            self::RESULT_P_DATA        => $result->getData(),
        ]);

        return $this;
    }
421862
public void setResult(R result) {
        try {
            lock.lock();
            this.result = result;
            notifyHaveResult();
        }
        finally {
            lock.unlock();
        }
    }
971098
protected function storeButton(ButtonBuilder $buttonBuilder, FormBuilderInterface $form, $position)
    {

        if (!isset($this->buttons[$form->getName()])) {
            $this->buttons[$form->getName()] = array();
        }

        $this->buttons[$form->getName()][$position] = $buttonBuilder;
    }
85063
function setResult( $result )
    {
        $this->Parameters['result'] = $result;
        $http = eZHTTPTool::instance();
        $http->setSessionVariable( 'ContentUploadParameters', $this->Parameters );
    }
351337
public function setResult($result = null)
    {
        $this->result = $result;
        $this->state = self::STATE_DONE;
        if ($this->listeners) {
            $this->listeners->executeAll($this->result);
        }
    }
213464
public function on_after_write_attempt($attempt, $result) {
        global $PAGE;

        if ($formdata = $result->postdata) {
            // Save any linked files if we are using an editor.
            $editoroptions = array(
                'maxbytes' => $PAGE->course->maxbytes,
                'context' => context_module::instance($PAGE->cm->id),
                'noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES,
                'enable_filemanagement' => false,
            );

            $formdata = file_postupdate_standard_editor($formdata, 'answer', $editoroptions,
                $editoroptions['context'], 'mod_lesson', 'essay_answers', $attempt->id);

            // Update the student response to have the modified link.
            $useranswer = unserialize($attempt->useranswer);
            $useranswer->answer = $formdata->answer;
            $useranswer->answerformat = $formdata->answerformat;
            $attempt->useranswer = serialize($useranswer);

            $result->studentanswer = $formdata->answer;
            $result->studentanswerformat = $formdata->answerformat;
            return [$attempt, $result];
        }

        return parent::on_after_write_attempt($attempt, $result);
    }
567185
protected function populateResultEventData(
        $result,
        array $event
    ) {
        $dataFormat = static::getResponseData($result);
        foreach ($dataFormat as $eventKey => $value) {
            if ($value !== null) {
                $event[$eventKey] = $value;
            }
        }
        return $event;
    }