I
I
Ilya2014-10-25 21:09:20
CodeIgniter
Ilya, 2014-10-25 21:09:20

How to load models in rest full codeginiter?

Actually a subject. How to load several models in codeigniter when using a well-known library to create a rest full api. Library - https://github.com/chriskacerguis/codeigniter-rest...
The problem is that when loading the second model in the constructor (yes, anywhere in the controller), codeigniter does not see the second model.

function __construct()
    {
        parent::__construct();

        $this->load->model('api/v1/users_model');
        $this->load->model('api/v1/auth_model');

        date_default_timezone_set('Europe/Moscow');
        $type_data = "%Y-%m-%d";
        $time = time();
        $this->date = mdate($type_data, $time);
    }

<p>Severity: Notice</p>
<p>Message:  Undefined property: Users::$auth_model</p>
<p>Filename: v1/users.php</p>
<p>Line Number: 73</p>

PS Version codeigniter 2.2, the latest version of the library. Subfolders for controllers are also used. But I removed the nesting, nothing changes.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question