Php Symfony-ClassNotFoundException:试图加载类;DoctrinBundle“;
我正在尝试安装带有Symfony文档的DoctrinBundle。我配置了AppKernel和config.yml,当我尝试运行命令:“php应用程序/控制台原则:迁移:状态”时,会显示此错误:Php Symfony-ClassNotFoundException:试图加载类;DoctrinBundle“;,php,symfony,Php,Symfony,我正在尝试安装带有Symfony文档的DoctrinBundle。我配置了AppKernel和config.yml,当我尝试运行命令:“php应用程序/控制台原则:迁移:状态”时,会显示此错误: PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DoctrineMigrationsBundle" from namespa
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DoctrineMigrationsBundle" from namespace "Doctrine\Bundle\MigrationsBundle".
Did you forget a "use" statement for another namespace? in /home/xxx/project/app/AppKernel.php:17
Stack trace:
#0 /home/xxx/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(448): AppKernel->registerBundles()
#1 /home/xxx/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(114): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 /home/xxx/project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(59): Symfony\Component\HttpKernel\Kernel->boot()
#3 /home/xxx/project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(122): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /home/xxx/project/bin/console(27): Symfony\Component\C in /home/xxx/project/app/AppKernel.php on line 17
AppKernel:
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
if ('dev' === $this->getEnvironment()) {
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
}
}
return $bundles;
}
public function getRootDir()
{
return __DIR__;
}
public function getCacheDir()
{
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
}
public function getLogDir()
{
return dirname(__DIR__).'/var/logs';
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
}
尝试composer dump autoload
。然后再次运行该命令。尝试删除vendor
目录,然后运行composer install
I remove。当我运行composer install时,在安装[生成自动加载文件]结束时,我遇到了一个异常:“无法扫描“/home/xxx/project/vendor/jdorn/sql formatter/lib”中的类,它既不是文件也不是文件夹。