Reputation: 31
So I've seen similar questions regarding this error, but none of the answers worked for me so I thought I'd try posting a new one!
I'm working through the Symblog tutorial and am having trouble with Twig Extensions in part 5. I'm currently getting the following error:
ClassNotFoundException in AppKernel.php line 20: Attempted to load class "BloggerBlogBundle" from namespace "Blogger\BlogBundle". Did you forget a "use" statement for another namespace?
I really don't think I'm missing any use statements in AppKernel.php, and have tried adding more to no avail. I've seen composer update, composer install, php composer.phar update, and various cache clearing methods offered as possible solutions for this, but none of them have worked for me.
Here's my AppKernel.php:
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
use Blogger\BlogBundle\Twig\Extensions;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
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 Blogger\BlogBundle\BloggerBlogBundle(),
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
$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 registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
public function init()
{
date_default_timezone_set( 'America/Los_Angeles' );
parent::init();
}
}
Any help or insight into what could be going on here would be greatly appreciated. Thanks!
Upvotes: 1
Views: 2903
Reputation: 31
Aaaand, there was no BloggerBlogBundle.php. Stupid on my part, but the tutorial I was following never said to make one so I thought it was trying to access BloggerBlogExtension.php from inside the Blogger/BlogBundle directory. Added a BloggerBlogBundle.php file with the following in it and am up and running again!
<?php
namespace Blogger\BlogBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class BloggerBlogBundle extends Bundle
{
}
Thanks!
Upvotes: 1