【发布时间】:2015-04-22 08:28:15
【问题描述】:
我在 symfony 2 中工作,我正在尝试使用 FOSUserBundle 但我无法解决这个问题:请帮助
[LogicException]
Bundle "BlogUserBundle" extends bundle "FOSUserBundle",
which is not registered.
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
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 Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new FOS\UserBundle\FOSUserBundle(),
new Blog\UserBundle\BlogUserBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$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(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
【问题讨论】:
-
很可能你还没有在
AppKernel.php注册你的包,你能再检查一次吗? -
我已经做了,这是我的内核
-
您能否编辑您的问题,添加您的 AppKernel::registerBundles 方法的代码?
标签: symfony symfony-forms symfony-2.1 symfony-2.3