I can't seem to figure out a way to call a method called insertValue()
;
My bootstrap takes the url and splits it into pieces so www.URL.com/register/register becomes
url[0]=register;
url[1] = register;
$controller = new url[0];
$controller->loadModel();
if islet($url[1])
$controller->{url[1]};
class Controller {
public $model;
function __construct() {
$this->view = new View(); //(irrelevant)
}
public function loadModel($name) {
...
$this->model = new $modelName;
}
}
The model class is as follows
class Model {
public $database;
function__construct() {
$this->database = new Database();
}
}
So the database class is as follows
class Database {
insertValue(){
...
}
}
Now, I have a bootstrap which creates a register class that extends controller as follows:
class Register extends Controller {
function__construct(){
parent::__construct();
}
public static function register (){
HERE IS WHERE I WANT TO CALL THE INSERT VALUE FUNCTION FROM DATABASE CLASS
}
}
The bootstrap also creates my model class by saying Register->loadModel();
which simply looks like this:
class registerModel extends Model {
function __construct() {
parent::__construct();
}
I can't at all figure out how to call the insertValue function. I tried $this->model->database->insertValue();
but that didn't work.
P.S. I notice that when I call this function, that the code beneath it does not get called, but no error message is given.