I cant seem to load application/model/Event.php model class then access a method from it.
Instead CI loads application/core/App_loader.php and tries to look for the method there.
Can anyone lend a hand on how to fix this please?
In: application/config/config.php
//$config['subclass_prefix'] = 'MY_';
$config['subclass_prefix'] = 'App_';
Event.php
class Event extends CI_Model {
private $db_main;
function __construct() {
parent::__construct();
$this->db_main = $this->load->database('main', TRUE);
}
function get($arr = array()) {
// ! Trying to access this method ...
}
}
From controller I am trying to load a model class called Event (verified that function index() gets called): application/controller/home.php
class Home extends App_Controller {
private $event;
function __construct() {
parent::__construct();
$this->event = $this->load->model('Event');
}
function index() {
$this->method1();
}
function method1() {
$eventArr = $this->event->get(); // << Cant access method
}
Message: Call to undefined method App_Loader::get()
inside application/core/App_loader.php:
class App_Loader extends CI_Loader {
function __construct() {
parent::__construct();
}
function aa(){}
function bb(){}
function cc(){}
}
Message: Cannot access private property Home::$eventFilename: C:\xampp\htdocs\myproject\system\core\Loader.php//private $event;on top and load model$this->load->model('Event');then try to access method$this->event->get();I get an errorMessage: Undefined property: Home::$event