2017-01-22 6 views
0

私のsymfonyプロジェクトで多くの問題が発生しています。私は掃除しようとすると、私の最後の問題は、キャッシュ:[Symfony Component Config Exception FileLoaderLoadException] "@ UserBundle/Controller /"リソースを読み込めません。

php bin/console cache:clear --env=prod --no-debug 

コンソールが私を返す:

[symfonyの\コンポーネント\ CONFIG \例外の\ FileLoaderLoadException]
がリソースを読み込むことができません「@ UserBundle /コントローラ/ " "UserBundle"バンドルが正しく登録され、 アプリケーションカーネルクラスにロードされていることを確認してください。バンドルが登録されている場合は、 バンドルパス "@ UserBundle/Control ler /"が空でないことを確認してください。 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 Nelmio\ApiDocBundle\NelmioApiDocBundle(), 
      new HomeBundle\HomeBundle(), 
      new UserBundle\UserBundle(), 
     ]; 

     if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { 
      $bundles[] = new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(); 
      $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); 
      $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); 
      $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); 
      $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); 
     } 

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

のrouting.yml:

user: 
    resource: "@UserBundle/Controller" 
    type:  annotation 
    prefix: /user 

home: 
    resource: "@HomeBundle/Controller" 
    type:  annotation 
    prefix: /

NelmioApiDocBundle: 
    resource: "@NelmioApiDocBundle/Resources/config/routing.yml" 
    prefix: /api/doc 

私はその問題は私に私の中のインデックスを与えていると思う私は右AppKernelとのrouting.ymlを持っていると思う

ウェブサイト

+0

は注意してください。 'routing.yml'の' user: 'は' home: 'と' NelmioApiDocBundle: 'と同じレベルでなければなりません。 –

+0

申し訳ありませんコピーして貼り付けたときに、ymlファイルに悪いことがありました。 @DanCostinel – Sermanes

+0

'UserBundle'のディレクトリ構造を投稿します。 –

答えて

0

私は、エラーを検出しましたSensioFrameworkExtraBundleが悪いあったが宣言: `yml`構文を書くとき

<?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 Nelmio\ApiDocBundle\NelmioApiDocBundle(), 
       //this bundle must be here 
       new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(); 
       new HomeBundle\HomeBundle(), 
       new UserBundle\UserBundle(), 
      ]; 

      if (in_array($this->getEnvironment(), ['dev', 'test'], true)) 
       //remove SensioFrameworkbundle 
       $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); 
       $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); 
       $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); 
       $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); 
      } 

      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'); 
     } 
    } 
関連する問題