protected function attached($parent) { parent::attached($parent); if (!$this->session && $parent instanceof Nette\Application\UI\Presenter) { $this->session = $parent->getSession(); } }