Browse code

The controller object as L3 property

RafaƂ Szklarczyk authored on 05/02/2020 12:17:53
Showing 1 changed files
... ...
@@ -13,9 +13,10 @@ class Application{
13 13
     public $controllersDirectory; // subdirectory/namespace part added to controller class 
14 14
     public $viewsDirectory; // subdirectory to search for the view files
15 15
     public $applicationDirectory; // subdirectory/namespace part of the application
16
-    public $controller; //Active controller
17
-    public $module; //Active module
18
-    public $action; //Active action
16
+    public $controller; //Active controller name
17
+    public $controllerObject; //Active controller object
18
+    public $module; //Active module name
19
+    public $action; //Active action name
19 20
 
20 21
     public function __construct($config){
21 22
         //set L3 application config
... ...
@@ -157,7 +158,7 @@ class Application{
157 158
                 .$controller;
158 159
             
159 160
             if(class_exists($controller_class,true)){
160
-                $controller_object = new $controller_class($this);
161
+                $this->controllerObject = $controller_object = new $controller_class($this);
161 162
             }
162 163
             else{
163 164
                 return $this->handle404($this->request);