Oddities when mixing Zend Framework 1.11 & Doctrine 2 Autoloaders

Posted by jiewmeng on Stack Overflow See other posts from Stack Overflow or by jiewmeng
Published on 2010-12-22T07:39:47Z Indexed on 2010/12/22 8:54 UTC
Read the original article Hit count: 367

I have setup autoloading in my ZF/Doctrine2 app as follows

$zendAutoloader = Zend_Loader_Autoloader::getInstance();

$autoloader = array(new ClassLoader('Symfony'), 'loadClass');
$zendAutoloader->pushAutoloader($autoloader, 'Symfony');
$autoloader = array(new ClassLoader('Doctrine'), 'loadClass');
$zendAutoloader->pushAutoloader($autoloader, 'Doctrine');
$autoloader = array(new ClassLoader('Application', realpath(__DIR__ . '/..')), 'loadClass');
$zendAutoloader->pushAutoloader($autoloader, 'Application');

$autoloader = array(new ClassLoader('DoctrineExtensions'), 'loadClass');
$zendAutoloader->pushAutoloader($autoloader, 'DoctrineExtensions');

I find that the DoctrineExtensions autoloading is not working while other classes are ... to verify that the path etc are right, I tried

$autoloader = new ClassLoader('DoctrineExtensions');
$autoloader->register();

And it works. So it seems it has something to do with Zend Framework?

© Stack Overflow or respective owner

Related posts about zend-framework

Related posts about autoload