I see the following infos in the debug-toolbar
"[DEPRECATED] Creation of dynamic property App\Libraries\MyLib::$ModulesModel is deprecated in APPPATH/Libraries/MyLib.php on line 128. 1 APPPATH/Controllers/BaseController.php(71): App\Libraries\MyLib->__construct() 2 SYSTEMPATH/CodeIgniter.php(904): App\Controllers\BaseController->initController(Object(CodeIgniter\HTTP\IncomingRequest), Object(CodeIgniter\HTTP\Response), Object(CodeIgniter\Log\Logger)) 3 SYSTEMPATH/CodeIgniter.php(500): CodeIgniter\CodeIgniter->createController() 4 SYSTEMPATH/CodeIgniter.php(355): CodeIgniter\CodeIgniter->handleRequest(null, Object(Config\Cache), false) 5 SYSTEMPATH/Boot.php(325): CodeIgniter\CodeIgniter->run() 6 SYSTEMPATH/Boot.php(67): CodeIgniter\Boot::runCodeIgniter(Object(CodeIgniter\CodeIgniter)) 7 FCPATH/index.php(56): CodeIgniter\Boot::bootWeb(Object(Config\Paths))"
So have a look at the line i found this
Code:
//Construct
function __construct()
{
//Session
$this->session = session();
//Models
$this->ModulesModel = model('ModulesModel'); //This is line 128
$this->UsersModel = model('UsersModel');
$this->RolesModel = model('RolesModel');
$this->CompanyModel = model('CompanyModel');
//Helper
$this->current_url = current_url(true);
...
}
What is wrong with this, and how i can do it, may i dont need to create a own instance of each needed modell in the library!?