codeigniter instance of model class

Viewed 12011

I'm developing a site with codeigniter. Now, normally when you use a class in codeigniter, you basically use it as if it were a static class. For example, if I head a model called 'user', I would first load it using

$this->load->model('user');

and than, I could invoke methods on that user class like

$this->user->make_sandwitch('cheese');

in the application that I'm building, I would like to have one UserManagement class, which uses a class called 'user'.

so that, for example I could

$this->usermanager->by_id(3);

and this would return an instance of the user model where the id is 3. What's the best way to do that?

3 Answers
Related