我使用app/console创建了一个新软件包。试着打印一个简单的问候,让我可以继续前进。我自动加载的命名空间,注册了捆绑,创建了一个页面,但Symfony的检测到异常:Symfony2软件包未注册
Bundle "PageBundle" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() function of your AppKernel.php file?
可是我已经这样做了。
日志显示:
[2011-06-08 23:41:56] request.CRITICAL: InvalidArgumentException: Bundle "PageBundle" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() function of your AppKernel.php file? (uncaught exception) at /Applications/MAMP/htdocs/Symfony/app/bootstrap.php.cache line 634
我也被清除缓存文件夹开发。任何人都可以帮我弄清楚什么是错的。我之前做过这件事,这是我第一次遇到这个问题。与bootstrap.php.cache有关的东西
谢谢!感谢所有的帮助。
CODE:
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 Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Webmuch\PageBundle\WebmuchPageBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Symfony\Bundle\WebConfiguratorBundle\SymfonyWebConfiguratorBundle();
}
return $bundles;
}
束还示出了如在分析器的有源束。
我删除了缓存和引导文件。然后从控制台重建引导文件。还是一样的错误。我错过了什么? – Aayush 2011-06-08 19:25:34
向我们展示您的registerBundles()函数。 – 2011-06-08 19:29:05
我已将它添加到问题中。谢谢! – Aayush 2011-06-09 16:29:55