Example #1
0
 public function __construct($config = null)
 {
     if (is_null($config)) {
         $this->config = Sophwork::getConfig();
     } else {
         $this->config = $config;
     }
     $this->link = $this->connectDatabase();
 }
Example #2
0
 /**
  *	@param none
  *	instanciate all Sophwork classes :
  *		AppView
  *		AppController
  *		AppModel
  *
  * 	This class is the base of the sophork architecture.
  * 	All you need to do is instanciate this class in your index file
  * 	and then, acccess throught it to all the others class
  *
  * 	Beacause all others classes and controllers inherite from this class
  * 	appController is use as a singleton
  */
 public function __construct($config = null)
 {
     parent::__construct();
     if (is_null($config)) {
         $this->config = Sophwork::getConfig();
     } else {
         $this->config = $config;
     }
     $this->appView = new AppView();
     $this->appModel = new AppModel($this->config);
     if (!$this instanceof AppController) {
         $this->appController = new AppController($this->appModel);
     }
     if (!$this instanceof AppDispatcher) {
         $this->appDispatcher = new AppDispatcher($this);
     }
     $this->route = [];
 }
Example #3
0
 /**
  *	@param none
  *	instanciate all Sophwork classes :
  *		AppView
  *		AppController
  *		AppModel
  *
  * 	This class is the base of the sophork architecture.
  * 	All you need to do is instanciate this class in your index file
  * 	and then, acccess throught it to all the others class
  *
  * 	Beacause all others classes and controllers inherite from this class
  * 	appController is use as a singleton
  */
 public function __construct($config = null)
 {
     parent::__construct();
     if (is_null($config)) {
         if (Sophwork::getConfig()) {
             $this->config = Sophwork::getConfig();
         } else {
             $this->config = ["baseUri" => "", "template" => ""];
         }
     } else {
         $this->config = $config;
     }
     $this->appView = new AppView($this->config);
     $this->appModel = new AppModel($this->config);
     if (!$this instanceof AppController) {
         $this->appController = new AppController($this->appModel);
     }
     if (!$this instanceof AppDispatcher) {
         $this->appDispatcher = new AppDispatcher($this);
     }
     $this->routes = [];
     $this->debug = false;
     $this->_factory = [];
 }