From 5dced5f990aebf47b3157e6efc7aa274c4fb4cbc Mon Sep 17 00:00:00 2001 From: corpsee Date: Sun, 11 Jan 2015 16:44:34 +0600 Subject: [PATCH] Fixing fatal error with $this->controller->layout in Application class. Closes #736 --- PHPCI/Application.php | 7 ++++++- PHPCI/Controller.php | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/PHPCI/Application.php b/PHPCI/Application.php index 88380c87..a8790804 100644 --- a/PHPCI/Application.php +++ b/PHPCI/Application.php @@ -22,6 +22,11 @@ use PHPCI\Model\Build; */ class Application extends b8\Application { + /** + * @var \PHPCI\Controller + */ + protected $controller; + /** * Initialise PHPCI - Handles session verification, routing, etc. */ @@ -100,7 +105,7 @@ class Application extends b8\Application $this->response->setContent($view->render()); } - if ($this->response->hasLayout()) { + if ($this->response->hasLayout() && $this->controller->layout) { $this->setLayoutVariables($this->controller->layout); $this->controller->layout->content = $this->response->getContent(); diff --git a/PHPCI/Controller.php b/PHPCI/Controller.php index b065e857..5fd22594 100644 --- a/PHPCI/Controller.php +++ b/PHPCI/Controller.php @@ -30,6 +30,11 @@ class Controller extends \b8\Controller */ protected $view; + /** + * @var \b8\View + */ + public $layout; + /** * Initialise the controller. */