I am having a lot of problems with my Symfony project in prod. My last problem is when I try to clean cache:
php bin/console cache:clear --env=prod --no-debug
console return me:
[Symfony\Component\Config\Exception\FileLoaderLoadException]
Cannot load resource "@UserBundle/Controller/". Make sure the "UserBundle" bundle is correctly registered and loaded in the application kernel class. If the bundle is registered, make sure the bundle path "@UserBundle/Control ler/" is not empty.
I think I have right AppKernel and routing.yml: 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
I think that problem is giving me a index of in my website.
yml
syntax. Thatuser:
fromrouting.yml
should be at the same level ashome:
andNelmioApiDocBundle:
. – Dan CostinelUserBundle
. – Dan Costinel