The following notice and warning occurs after var_dump has excecuted correctly; i.e. var_dump($params) works, but these errors occur thereafter.
I found that using public function __construct($params='') in Models_Index class will cause ommition of these errors from occuring, but I'm not sure why they occur, or why this helps.
Warning: Missing argument 1 for Models_Index::__construct()
Notice: Undefined variable: params in models_index class on line 7
class Router {
public function __construct(){
$cont = new Controller('Passing params');
}
}
new Router;
class Controller extends Core_Controller {
public function __construct($params) {
$model = $this->model("Models_Index", $params);
}
}
class Core_Controller {
protected function model($model, $params) {
$model = new Models_Index($params);
return new $model;
}
}
class Models_Index extends Core_Model {
public function __construct($params) {
var_dump($params); // line 7
}
}
$paramsyou're trying to pass into it withnew Controller($params)?$paramsa value when it is sent to theModels_Indexconstructor?