Skip to content

Instantly share code, notes, and snippets.

@matej21
Last active November 29, 2015 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matej21/f987d925863fba7fc5cf to your computer and use it in GitHub Desktop.
Save matej21/f987d925863fba7fc5cf to your computer and use it in GitHub Desktop.
<?php
class SessionCleanerListener implements Kdyby\Events\Subscriber
{
private $session;
public function __construct(Nette\Http\Session $session)
{
$this->session = $session;
}
public function getSubscribedEvents()
{
return ['Nette\Application\Application::onRequest'];
}
public function onRequest(Nette\Application\Application $app, Nette\Application\Request $request)
{
if ($request->getPresenterName() === 'Foo' && $request->getParameter('action') === 'create') {
return;
}
$this->session->getSection('xyzData')->foo = NULL;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment