我使用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