I have set up a project with CodeIgniter 2.1 and Doctrine 2.2, following the instruction on Doctrine cookbook. The EntityManager works, but when I try to load entity models, it gives me error
Fatal error: Class 'Users' not found in /Volumes/Data/Projects/myproject/application/controllers/home.php on line 10
This is my home.php file:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
//require_once(APPPATH.'models/Users.php');
class Home extends CI_Controller {
public function index()
{
$em = $this->doctrine->em;
$users = new Users;
//$user = $em->find("Users", 1);
$em->flush(); // dummy
$this->load->view('welcome_message');
}
}
If I uncomment line 3: require_once(APPPATH.'models/Users.php');
, then
it works perfectly.
How can I make the models auto-loaded?
Is the autoload mechanism handled by the bootstrap in libraries/ Doctrine.php, isn't it?
$entitiesClassLoader = new ClassLoader('models', rtrim(APPPATH, "/" ));
$entitiesClassLoader->register();
Please anyone give me insight about this issue.