I have a bundle in symproject/src/MyAppBundle/src/Bundle
This folder contains MyAppBundle.php
:
<?php
namespace MyCompany\Action\Provider\MyAppBundle\Bundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class MyAppBundle extends Bundle
{
}
Then I register it in App/Appkernel.php
:
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 Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new MyCompany\Action\Provider\MyAppBundle\Bundle\MyAppbundle(),
];
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;
}
The site won't work at all after doing this. The log says:
PHP Fatal error: Uncaught Error: Class 'MyCompany\Action\Provider\MyAppProvider\Bundle\MyAppBundle' not found in /var/www/html/symproject/app/AppKernel.php:20\nStack trace:\n#0 /var/www/html/symproject/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(494): AppKernel->registerBundles()\n#1 /var/www/html/symproject/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(134): Symfony\Component\HttpKernel\Kernel->initializeBundles()\n#2 /var/www/html/symproject/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(197): Symfony\Component\HttpKernel\Kernel->boot()\n#3 /var/www/html/symproject/web/app.php(19): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request))\n#4 {main}\n thrown in /var/www/html/symproject/app/AppKernel.php on line 20
MyCompany\ACtion\Provider\MyAppProvider\Bundle\MyAppBundle
is not found, do you have the class already ? did you configure auto-loading for the bundle ? – Saif Eddin Gmatisymproject/src/MyAppBundle/src/Bundle/MyAppBundle.php
should besymproject/src/MyAppBundle/MyAppBundle.php
and then adjust your namespaces. Or you have to define a psr-4 in your composer. You've messed up something i think. – Jack Skeletron