Save registration info locally so it can be retrieved when registration needs to be updated

@param stdClass $formdata data from {@link site_registration_form}
558817
public static function save_site_info($formdata) {
        $cleanhuburl = clean_param(HUB_MOODLEORGHUBURL, PARAM_ALPHANUMEXT);
        foreach (self::FORM_FIELDS as $field) {
            set_config('site_' . $field . '_' . $cleanhuburl, $formdata->$field, 'hub');
        }
        // Even if the the connection with moodle.net fails, admin has manually submitted the form which means they don't need
        // to be redirected to the site registration page any more.
        set_config('site_regupdateversion_' . $cleanhuburl, max(array_keys(self::CONFIRM_NEW_FIELDS)), 'hub');
    }
1105328
public function onFormSuccess(FormEvent $event)
    {
        $form = $event->getForm();

        $result = $this->createResult($form);

        if ($form->getStoreResults()) {
            $this->storeResult($form, $result);
        }

        if ($form->getSendMail()) {
            $this->sendMail($form, $result);
        }

        $successUrl = $form->getSuccessUrl();

        if ($successUrl != null) {
            $redirectResponse = new RedirectResponse($successUrl);
            $redirectResponse->send();
        }
    }
335588
public function save(stdClass $submission, stdClass $data) {
        global $USER, $DB;

        $fileoptions = $this->get_file_options();

        $data = file_postupdate_standard_filemanager($data,
                                                     'files',
                                                     $fileoptions,
                                                     $this->assignment->get_context(),
                                                     'assignsubmission_file',
                                                     ASSIGNSUBMISSION_FILE_FILEAREA,
                                                     $submission->id);

        $filesubmission = $this->get_file_submission($submission->id);

        // Plagiarism code event trigger when files are uploaded.

        $fs = get_file_storage();
        $files = $fs->get_area_files($this->assignment->get_context()->id,
                                     'assignsubmission_file',
                                     ASSIGNSUBMISSION_FILE_FILEAREA,
                                     $submission->id,
                                     'id',
                                     false);

        $count = $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA);

        $params = array(
            'context' => context_module::instance($this->assignment->get_course_module()->id),
            'courseid' => $this->assignment->get_course()->id,
            'objectid' => $submission->id,
            'other' => array(
                'content' => '',
                'pathnamehashes' => array_keys($files)
            )
        );
        if (!empty($submission->userid) && ($submission->userid != $USER->id)) {
            $params['relateduserid'] = $submission->userid;
        }
        if ($this->assignment->is_blind_marking()) {
            $params['anonymous'] = 1;
        }
        $event = \assignsubmission_file\event\assessable_uploaded::create($params);
        $event->set_legacy_files($files);
        $event->trigger();

        $groupname = null;
        $groupid = 0;
        // Get the group name as other fields are not transcribed in the logs and this information is important.
        if (empty($submission->userid) && !empty($submission->groupid)) {
            $groupname = $DB->get_field('groups', 'name', array('id' => $submission->groupid), MUST_EXIST);
            $groupid = $submission->groupid;
        } else {
            $params['relateduserid'] = $submission->userid;
        }

        // Unset the objectid and other field from params for use in submission events.
        unset($params['objectid']);
        unset($params['other']);
        $params['other'] = array(
            'submissionid' => $submission->id,
            'submissionattempt' => $submission->attemptnumber,
            'submissionstatus' => $submission->status,
            'filesubmissioncount' => $count,
            'groupid' => $groupid,
            'groupname' => $groupname
        );

        if ($filesubmission) {
            $filesubmission->numfiles = $this->count_files($submission->id,
                                                           ASSIGNSUBMISSION_FILE_FILEAREA);
            $updatestatus = $DB->update_record('assignsubmission_file', $filesubmission);
            $params['objectid'] = $filesubmission->id;

            $event = \assignsubmission_file\event\submission_updated::create($params);
            $event->set_assign($this->assignment);
            $event->trigger();
            return $updatestatus;
        } else {
            $filesubmission = new stdClass();
            $filesubmission->numfiles = $this->count_files($submission->id,
                                                           ASSIGNSUBMISSION_FILE_FILEAREA);
            $filesubmission->submission = $submission->id;
            $filesubmission->assignment = $this->assignment->get_instance()->id;
            $filesubmission->id = $DB->insert_record('assignsubmission_file', $filesubmission);
            $params['objectid'] = $filesubmission->id;

            $event = \assignsubmission_file\event\submission_created::create($params);
            $event->set_assign($this->assignment);
            $event->trigger();
            return $filesubmission->id > 0;
        }
    }
237137
protected function loadFormData()
    {
        parent::loadFormData();

        if (! isset($this->formData['change_method'])) {
            $this->formData['change_method'] = null;
        }
        $this->formData['orig_org_id'] = $this->request->getParam(\MUtil_Model::REQUEST_ID2);
    }
1282776
protected function getUpdateEvent($formData)
    {
        $event =  $this->getCreateOrUpdateEvent($formData);

        $event->setAddress($this->getExistingObject());

        return $event;
    }
84522
public function validate($formData)
	{
		$formData = $this->normalizeFormData($formData);

		$this->validation = $this->validator->make(
			$formData,
			$this->getValidationRules(),
			$this->getValidationMessages()
		);

		if ($this->validation->fails())
		{
			throw new FormValidationException('Validation failed', $this->getValidationErrors());
		}

		return true;
	}
1032969
public function onPreSetData(FormEvent $event)
    {
        /** @var CustomUrlAddData $data */
        $data = $event->getData();
        $location = $data->getLocation();
        if (null === $location) {
            return;
        }
        $contentInfo = $location->getContentInfo();
        $versionInfo = $this->contentService->loadVersionInfo($contentInfo);
        $contentLanguages = $versionInfo->languageCodes;

        $form = $event->getForm();

        $form->add(
            'language',
            ChoiceType::class,
            [
                'multiple' => false,
                'choice_loader' => new CallbackChoiceLoader($this->getCallableFilter($contentLanguages)),
                'choice_value' => 'languageCode',
                'choice_label' => 'name',
            ]
        );
    }
1030444
protected function getCreationEvent($formData)
    {
        $event = $this->getCreateOrUpdateEvent($formData);

        $customer = CustomerQuery::create()->findPk($this->getRequest()->get("customer_id"));

        $event->setCustomer($customer);

        return $event;
    }
1219266
public static function save_filter(stdclass $data, stdclass $persistant) {
        if (!isset($persistant->tool_customlang_filter)) {
            $persistant->tool_customlang_filter = array();
        }
        foreach ($data as $key => $value) {
            if ($key !== 'submit') {
                $persistant->tool_customlang_filter[$key] = serialize($value);
            }
        }
    }
1353483
public function registerData(array $entityData)
    {
        foreach ($entityData as $data) {
            $this->registerEntity($this->normalizer->denormalize(
                $data,
                $this->entityCollection->getEntityClass()
            ));
        }
    }
781681
public function index(FormData $formData, $properties)
    {
        $id = $this->persistenceManager->getIdentifierByObject($formData);
        $formValues = json_decode($formData->getFormValues(), true);
        $formValues['_date'] = $formData->getDate();
        $data = $this->parseData($formValues, $properties);
        $index = $this->getIndex();
        $type = $this->getType($index, $formData->getFormIdentifier(), $properties);
        $document = new Document($type, $data, $id);
        $document->store();
    }
498037
public function preSetData(FormEvent $event)
    {
        $entity = $event->getData();
    
        if ($entity instanceof FileInterface && null !== $entity->getId()){
            try {
                $this->fileManager->copyFileToTemporaryDirectory($entity);
            } catch (\Gaufrette\Exception\FileNotFound $e) {
                $event->setData(null);
            }
        }
    }
1173205
public function check_data($formdata) {
        $field    = $this->_name;
        $role     = $field .'_rl';
        $category = $field .'_ct';

        if (array_key_exists($field, $formdata)) {
            if (empty($formdata->$field) and empty($formdata->$role) and empty($formdata->$category)) {
                // Nothing selected.
                return false;
            }
            return array('value'      => (string)$formdata->$field,
                         'roleid'     => (int)$formdata->$role,
                         'categoryid' => (int)$formdata->$category);
        }
        return false;
    }
782953
protected function getCreationEvent($formData)
    {
        $creationEvent = new FolderCreateEvent();

        $creationEvent
            ->setLocale($formData['locale'])
            ->setTitle($formData['title'])
            ->setVisible($formData['visible'])
            ->setParent($formData['parent']);

        return $creationEvent;
    }
1269164
public function submitForm($buttonText, $formData = null)
    {
        $this->client()->submit(
            $this->fillForm($buttonText, $formData)
        );

        $this->currentPage = $this->client()->getHistory()->current()->getUri();

        $this->clearInputs()->assertPageLoaded($this->currentPage());

        return $this;
    }
837166
protected function getCreationEvent($formData)
    {
        $orderStatusCreateEvent = new OrderStatusCreateEvent();

        $orderStatusCreateEvent
            ->setLocale($formData['locale'])
            ->setTitle($formData['title'])
            ->setCode($formData['code'])
            ->setColor($formData['color'])
        ;

        return $orderStatusCreateEvent;
    }
1354750
public function check_data($formdata) {
        $field = $this->_name;

        if (array_key_exists($field, $formdata) and $formdata->$field !== '') {
            return array('value' => (string)$formdata->$field);
        }

        return false;
    }