View difference between Paste ID: cXR1DSDj and Qzewnpx6
SHOW: | | - or go back to the newest paste.
1
<?php
2
class Control extends \Nette\Application\UI\Control
3
{
4
	public $onSuccess = array();
5
6
	public function something()
7
	{
8-
		$this->onSuccess(); // můžeš předat jakékoli parametry
8+
		$this->onSuccess($this); // můžeš předat jakékoli parametry
9
	}
10
}
11
12
class Presenter extends \Nette\Application\UI\Presenter
13
{
14-
	public function createComponentSomething()
14+
	protected function createComponentSomething()
15
	{
16
		$control = new Control();
17-
		
17+
		$control->onSuccess[] = function($control) {
18-
		$presenter = $this;
18+
			$control->presenter->redirect('Target:action');
19-
		$control->onSuccess[] = function() use ($presenter) {
19+
20-
			$presenter->redirect('Target:action');
20+
21
	}
22
}