Code within my model:
<?php
class Loginmodel extends Model {
private $user;
public function Loginmodel() {
parent::Model();
$this->load->library('Factory');
$this->factory->getUser('DS_Admin');
}
}
My library object:
<?php
class Factory {
public function __construct() {
//nothing
echo 'yay';
}
private function __autoload($classname) {
require_once('system/application/libraries/DS/'.$classname.'php');
}
public function getUser($usertype) {
switch ($usertype) {
case 'DS_Admin' :
return new DS_Admin;
case 'DS_Broker' :
return new DS_Broker;
case 'DS_MasterBroker' :
return new DS_MasterBroker;
default :
return false;
}
}
}
Now, the “yay” within my Factory constructor is getting outputted, so I know the library is being loaded.
However, when I attempt to access the “getUser()” function, I receive this error:
Fatal error: Call to a member function getUser() on a non-object in C:\wamp\www\broker\system\application\models\loginmodel.php on line 9
ergh - what am I missing??
