Because the class file does not have the same name as the class name, Yii is unable to load it automatically. You will need to install a separate autoload function (maybe it is provided by Doctrine already?)
I'm having the same problem. Doctrine also has it's own autoload function in Doctrine.php and is also called autoload(). I tried renaming this function to doctrine_autoload() and ran the following code.
Doctrine::loadModels('classes'); // This call will not require the found. php files
When it comes to the Doctrine_Manager statement, Yii is still trying to use the YiiBase autoload() function to load the Doctrine_Manager class and it errors out.
How do I install the doctrine_autoload() function to be called only if it's tryiing to load a Doctrine class? Should I edit YiiBase.php autoload() function? Is that the correct way to do it?
I got it working finally. The problem is that the YiiBase::autoload function is the first in the autoload stack and it errors out in that function before it goes to the Doctrine autoload function. If the YiiBase::autoload function returned a false if it didn't find the file, the stack would progress to the next autoload function. This has been done in the Doctrine autoload function. so I essentially put the Doctrine Autoload function first in the stack and readded the YiiBase::autoload second. Now it works.
Note: Do NOT rename the autoload function in doctrine since it is called explicitly in some places in Doctrine.
Here's the hack I used.
require_once ('protected/vendors/Doctrine/lib/Doctrine.php');
// register the autoloader
spl_autoload_unregister(array('YiiBase','autoload'));
spl_autoload_register(array('Doctrine','autoload'));
spl_autoload_register(array('YiiBase','autoload'));
//print_r(spl_autoload_functions());
Doctrine_Manager::getInstance()->setAttribute('model_loading','conservative');
Doctrine::loadModels('protected/models'); // This call will not require the found. php files
Hope that helps. I however would like to know if this is the right way to do it?