2017-11-26 9 views
1

私はDoctrineMigrationsBundleをSymfony Documentationでインストールしようとしています。私はAppKernelとconfig.ymlとを設定し、私は、コマンドを実行しようとしたとき: "PHPアプリ/コンソール教義:移行:ステータス" このエラーが表示されます。Symfony - ClassNotFoundException:クラス "DoctrineMigrationsBundle"を読み込もうとしました

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'); 
    } 
} 

I m really new in PHP&Symfony and I donトンをこの問題を解決する方法を多く知っている。手伝って頂けますか?

答えて

0

お試しcomposer dump-autoloadコマンドをもう一度実行します。

+0

[まだこのエラーがあります] – xampo

+0

'vendorディレクトリを削除して、' composer install'を実行してください。 –

+0

削除します。私はコンポーザーのインストールを実行し、インストールの最後に[自動ロードファイルを生成する]という例外があります: "/ home/xxx/project/vendor/jdorn/sql-formatter/lib"内のクラスをスキャンできませんでしたファイルでもフォルダでもないようです。 – xampo

関連する問題