Damn it ;) I just found the answer here:
http://weierophinney.net/matthew/archives/220-Autoloading-Doctrine-and-Doctrine-entities-from-Zend-Framework.html The last comment is: This solution didn't work for me when using Doctrine::getTable('MYTABLE') You also need to call add the model autoloader: $autoloader->registerNamespace('Doctrine')->pushAutoloader(array('Doctrine', 'modelsAutoload'), ''); Which is the oposite to my problem, for me Doctrine::getTable('MYTABLE') worked OK, but I couldn't load the models directly. So any hoo, to fix everything my bootstrap now has this: protected function _initDoctrine() { $this->getApplication() ->getAutoloader() ->registerNamespace('Doctrine') ->pushAutoloader(array('Doctrine', 'autoload')) ->pushAutoloader(array('Doctrine', 'modelsAutoload'), ''); $options = $this->getOption('doctrine'); $manager = Doctrine_Manager::getInstance(); $manager->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true); $manager->setAttribute( Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE ); $manager->setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES, true); Doctrine::loadModels($options['models_path']); $conn = Doctrine_Manager::connection($options['db'], 'doctrine'); $conn->setAttribute(Doctrine::ATTR_USE_NATIVE_ENUM, true); return $conn; } Then in my /models/ I have the doctrine classes like this: class Users extends Default_Model_Generated_BaseUsers { } in /models/generated/ I have had to alter the class names so they look like: abstract class Default_Model_Generated_BaseUsers extends Doctrine_Record { ....... Now in my Controller I can do both of these: $u = new Users(); $u = Doctrine::getTable('Users'); And all the JOINs and stuff work fine! Woop! Just pasted all this code in the hope it helps someone else out one day :) Thanks, monk.e.boy -- View this message in context: http://n4.nabble.com/auto-loader-question-tp1563248p1563255.html Sent from the Zend Framework mailing list archive at Nabble.com.
