Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifikator viditelnosti obsluhy komponenty #1071

Open
romanpiller opened this issue Jan 12, 2025 · 1 comment
Open

Modifikator viditelnosti obsluhy komponenty #1071

romanpiller opened this issue Jan 12, 2025 · 1 comment

Comments

@romanpiller
Copy link

URL: https://doc.nette.org/cs/quickstart/comments

private function commentFormSucceeded(\stdClass $data): void
{
	$id = $this->getParameter('id');

	$this->database->table('comments')->insert([
		'post_id' => $id,
		'name' => $data->name,
		'email' => $data->email,
		'content' => $data->content,
	]);

	$this->flashMessage('Děkuji za komentář', 'success');
	$this->redirect('this');
}

callback komponenty ma modifikator private a co som skusal moze byt len public, ani privat ani protected nie je spravne

@romanpiller romanpiller changed the title modifikator viditelnosti obsluhy komponenty Modifikator viditelnosti obsluhy komponenty Jan 12, 2025
@dg
Copy link
Member

dg commented Jan 12, 2025

Je potřeba použít zápis $form->onSuccess[] = $this->commentFormSucceeded(...);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants