autloading not working correct using autoloader.php in vendor directory

£可爱£侵袭症+ 提交于 2019-12-04 05:43:49

This is kind of a shot in the dark but Symfony 2 applications include an autoload.php file which explicitly loads an annotation registry.

// autoload.php
use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;

/**
 * @var ClassLoader $loader
 */
$loader = require __DIR__.'/../vendor/autoload.php';

AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

return $loader;

I never really researched why in any detail since I don't use annotations. But give it a try. Can't hurt.

This is a bit old, but I created a composer plugin which registers composer ClassLoader into the AnnotationRegistry as a loader.

https://github.com/indigophp/doctrine-annotation-autoload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!