2017-11-26 7 views
1

Ich versuche DoctrineMigrationsBundle mit Symfony Documentation zu installieren. Ich konfigurierte AppKernel und config.yml und wenn ich einen Befehl ausführen möchten: "php app/console Lehre: Migrationen: Status" dieser Fehler angezeigt wird:Symfony - ClassNotFoundException: Es wurde versucht, die Klasse "DoctrineMigrationsBundle" zu laden.

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 t weiß viel, wie man dieses Problem löst. Kannst du mir helfen?

Antwort

0

Versuchen Sie composer dump-autoload. Und führen Sie den Befehl erneut aus.

+0

Es funktioniert nicht [habe immer noch diesen Fehler] – xampo

+0

Versuchen Sie, 'Vendor'-Verzeichnis zu entfernen und' Composer-Installation' auszuführen –

+0

Ich entferne. Wenn ich composer install und am Ende der Installation [Autoload-Dateien generieren] habe, habe ich diese Ausnahme: "Konnte nicht nach Klassen innerhalb von"/home/xxx/project/vendor/jdorn/sql-formatter/lib "suchen scheint weder eine Datei noch ein Ordner zu sein. – xampo

Verwandte Themen