$values */ public function processSurveyForm(Nette\Forms\Form $form, array $values): void { if ($form->isValid()) { $this->database->beginTransaction(); try { $recordId = $this->database->table('survey')->insert( [ 'name' => $values['name'], 'comments' => $values['comments'], 'agreement' => $values['agreement'], ] ); foreach ($values['interests'] as $value) { $this->database->table('interests')->insert( [ 'survey_id' => $recordId, 'interest' => $value, ] ); } $this->database->commit(); $this->flashMessage($this->translator->translate('survey.successfullyFilled'), 'success'); $this->redirect('this'); } catch (\PDOException $e) { $this->database->rollback(); // TODO: Tady bych dal log do sentry a rekl uziteli at to zkusi pozdeji ;-) throw $e; } } } protected function createComponentSurveyForm(): Nette\Application\UI\Form { $form = $this->surveyFormFactor->create(); $form->onSuccess[] = [$this, 'processSurveyForm']; // @phpstan-ignore assign.propertyType return $form; } }