[eluser]benb[/eluser]
i have a factory library that create the model that i need, this model is extends an abstract model.
but when i want to load it i get an error that i didn't include the abstract model class.
there is a way to solve it? how can i include it?
this is my code:
Code:
class User extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->library('factory');
}
function register(){
$user = $this->factory->create('doctor'); // returns 'doctor_m' or 'patient_m'
$this->load->model($user);
$this->$user->addUser();
}
}
abstract class User_m extends CI_Model{
function __construct() {
parent::__construct();
}
abstract protected function addUser();
abstract protected function getUser();
}
class Doctor_m extends User_m{
function __construct() {
parent::__construct();
}
function addUser() {
echo "doctor";
}
function getUser() {
}
}
class Patient_m extends User_m{
function __construct() {
parent::__construct();
}
function addUser() {
echo 'patient';
}
function getUser() {
}
}
class factory{
function create($type){
if($type == 'doctor') return 'doctor_m';
else return 'patient_m';
}
}
am i doing it right? like MVC model? also i want to know how can i make it works.
thanks.