Fixed handling errors

This commit is contained in:
Marcin Kurczewski 2014-05-19 00:53:59 +02:00
parent fde6fc2a89
commit 837c04c400

View file

@ -3,7 +3,6 @@ class AbstractController
{ {
protected $assets; protected $assets;
private $layoutName; private $layoutName;
private static $isRendered;
public function isAjax() public function isAjax()
{ {
@ -18,12 +17,6 @@ class AbstractController
$this->assets->setTitle(Core::getConfig()->main->title); $this->assets->setTitle(Core::getConfig()->main->title);
} }
public function __destruct()
{
if ($this->isAjax())
$this->renderAjax();
}
public function renderAjax() public function renderAjax()
{ {
$this->switchLayout('layout-json'); $this->switchLayout('layout-json');
@ -38,11 +31,6 @@ class AbstractController
public function renderView($viewName) public function renderView($viewName)
{ {
//no matter which controller runs it (including ErrorController), render only once
if (self::isRendered())
return;
self::markAsRendered();
$context = Core::getContext(); $context = Core::getContext();
if ($viewName !== null) if ($viewName !== null)
$context->viewName = $viewName; $context->viewName = $viewName;
@ -65,16 +53,6 @@ class AbstractController
} }
private static function isRendered()
{
return self::$isRendered;
}
private static function markAsRendered()
{
self::$isRendered = true;
}
private function switchLayout($layoutName) private function switchLayout($layoutName)
{ {
$this->layoutName = $layoutName; $this->layoutName = $layoutName;