Doctrine lazy loading

syubgybkmh

New Member
I'm just getting to grips with Doctrine, and using the suggested lazy loading of models. As per the tutorials, I've created a doctrine bootstrap file:\[code\]<?phprequire_once(dirname(__FILE__) . '/libs/doctrine/lib/Doctrine.php');spl_autoload_register(array('Doctrine', 'autoload'));$manager = Doctrine_Manager::getInstance();$manager->setAttribute(Doctrine_Core::ATTR_AUTO_ACCESSOR_OVERRIDE, true);$manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE);Doctrine_Core::loadModels(array(dirname(__FILE__) . '/models/generated', dirname(__FILE__) . '/models')); //this line should apparently cause the Base classes to be loaded beforehand\[/code\]My models and base classes have all been created by Doctrine.I've also created a simple test file as follows:\[code\]<?phprequire_once('doctrine_bootstrap.php');$user = new User();$user->email = '[email protected]';echo $user->email;\[/code\]However, this generates the following error:\[code\]Fatal error: Class 'User' not found in E:\xampp\htdocs\apnew\services\doctrine_test.php on line 4\[/code\]However, if I explicitly require the BaseUser.php and User.php files, then it works fine without any errors\[code\]<?phprequire_once('doctrine_bootstrap.php');require_once('models/generated/BaseUser.php');require_once('models/User.php');$user = new User();$user->email = '[email protected]';echo $user->email;\[/code\]So, it seems that Doctine is not auto loading the models correctly. What am I missing?
 
Back
Top