混合使用 Zend Framework 1.11 和 Zend Framework 时出现的奇怪情况学说 2 自动装弹机
我在我的 ZF/Doctrine2 应用程序中设置了自动加载,如下所示
$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');
,我发现 DoctrineExtensions
自动加载不起作用,而其他类却......为了验证路径等是否正确,我尝试了
$autoloader = new ClassLoader('DoctrineExtensions');
$autoloader->register();
并且它有效。看来这和Zend Framework有关系?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,“Doctrine”唯一的自动加载器可能已经与 DoctrineExtensions 类匹配。您必须相应地重新排序它们。
well the "Doctrine" only autoloader probably already matches for the DoctrineExtensions classes. You have to reorder them accordingly.