AppKernel.php symfony 2.5.6检测捆绑包

AppKernel.php symfony 2.5.6检测捆绑包,php,symfony,Php,Symfony,我对AppKernel和bundle检测器有问题 我在2.5.6工作 事实上,我有一个错误: 捆绑包“mainBundle”不存在或未启用。也许您忘记将其添加到AppKernel.php文件的registerBundles()方法中了 但这里是我的AppKernel.php: <?php use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; class

我对AppKernel和bundle检测器有问题

我在2.5.6工作

事实上,我有一个错误: 捆绑包“mainBundle”不存在或未启用。也许您忘记将其添加到AppKernel.php文件的registerBundles()方法中了

但这里是我的AppKernel.php:

<?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 theia\mainBundle\theiamainBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            //$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
            $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');
    }
}
错误跟踪:

在第2359行的kernel.root_dir/bootstrap.php.cache中-public 函数getBundle($name,$first=true){if (!isset($this->bundleMap[$name]){抛出新的 \InvalidArgumentException(sprintf('Bundle“%s”)不存在或不存在 未启用。可能您忘记将其添加到registerBundles()中 %s.php文件的方法?',$name,get_class($this));}if(true) ==$first){返回$this->bundleMap[$name][0];在Kernel->getBundle('mainBundle',false)的Kernel.root_dir/cache/dev/classes.php中 第2332行+位于ControllerNameParser->parse 中的('mainBundle:security:login') kernel.root_dir/cache/dev/classes.php,第2384行+at ControllerResolver->createController('mainBundle:security:login') 在第2047行的kernel.root_dir/cache/dev/classes.php中 中的ControllerResolver->getController(对象(请求)) /opt/lampp/htdocs/my_projects/Symphony_projects/test/vendor/symfony/symfony/src/symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php 在第46行+在TraceableControllerResolver->getController处 (对象(请求))位于kernel.root_dir/bootstrap.php.cache的第2969行 +在HttpKernel->handleRaw(对象(请求),'1'),位于HttpKernel第2938行的kernel.root\u dir/bootstrap.php.cache中 ->在kernel.root_dir/bootstrap.php.cache的第3087行+at处处理(对象(请求),'1',true) ContainerWarehttpkernel->中的句柄(对象(请求),'1',true) kernel.root_dir/bootstrap.php.cache位于内核的2337+行 ->在/opt/lampp/htdocs/my_projects/Symphony_projects/test/web/app_dev.php中处理(对象(请求)) 第28行

这是跟踪日志

信息-匹配的路由“登录\路由”(参数:“\控制器”:“主捆绑包:安全:登录”,“\路由”:“登录\路由”) 使用匿名令牌填充信息的SecurityContext 调试-向侦听器“Symfony\Component\HttpKernel\EventListener\errorsLogger::injectLogger”通知事件“kernel.request”。 调试-向侦听器“Symfony\Component\HttpKernel\EventListener\errorsLogger::injectLogger”通知事件“kernel.request”。 调试-向侦听器“Symfony\Component\HttpKernel\EventListener\errorsLogger::injectLogger”通知事件“kernel.request”。 调试-向侦听器“Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure”通知事件“kernel.request”。 调试-向侦听器“Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest”通知事件“kernel.request”。 调试-向侦听器“Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest”通知事件“kernel.request”。 调试-向侦听器“Symfony\Component\HttpKernel\EventListener\FragmentListener::onKernelRequest”通知事件“kernel.request”。 调试-向侦听器“Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest”通知事件“kernel.request”。 调试-向侦听器“Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest”通知事件“kernel.request”。 调试-向侦听器“Symfony\Component\Security\Http\Firewall::onKernelRequest”通知事件“kernel.request”。 调试-通知事件“kernel.request”给监听器Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelReque 圣”

严重-未捕获的PHP异常InvalidArgumentException:“Bundle” “mainBundle”不存在或未启用。可能是您忘记了 将其添加到AppKernel.php文件的registerBundles()方法中 /opt/lampp/htdocs/my_projects/Symphony_projects/test/app/bootstrap.php.cache 第2359行

调试-向侦听器通知事件“kernel.request” “Symfony\Component\HttpKernel\EventListener\ErrorsLogger::injectLogger”。 调试-向侦听器通知事件“kernel.request” “Symfony\Component\HttpKernel\EventListener\ErrorsLogger::injectLogger”。 调试-向侦听器通知事件“kernel.request” “Symfony\Component\HttpKernel\EventListener\ErrorsLogger::injectLogger”。 调试-向侦听器通知事件“kernel.request” “Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure”。 调试-向侦听器通知事件“kernel.request” “Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest”。 调试-向侦听器通知事件“kernel.request” “Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest”。 调试-向侦听器通知事件“kernel.request” “Symfony\Component\HttpKernel\EventListener\FragmentListener::onKernelRequest”。 调试-向侦听器通知事件“kernel.request” “Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest”。 调试-向侦听器通知事件“kernel.request” “Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest”。 调试-向侦听器通知事件“kernel.request” “Symfony\Component\Security\Http\Firewall::onKernelRequest”。调试- 通知侦听器的事件“kernel.request” “Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest”。 调试-向侦听器通知事件“kernel.controller” “Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController”。 调试-向侦听器通知事件“kernel.controller” “Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController”。 调试-向侦听器通知事件“kernel.controller” “Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController”。 调试-向侦听器通知事件“kernel.controller” “森
t:
    resource: "@theiamainBundle/Resources/config/routing.yml"
    prefix:   /
at Symfony\Component\HttpKernel\Kernel->getBundle('mainBundle', false)
    in /opt/lampp/htdocs/my_projects/Symphony_projects/test/app/cache/dev/classes.php line 2332

at Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser->parse('mainBundle:security:login')
    in /opt/lampp/htdocs/my_projects/Symphony_projects/test/app/cache/dev/classes.php line 2384

at Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver->createController('mainBundle:security:login')
    in /opt/lampp/htdocs/my_projects/Symphony_projects/test/app/cache/dev/classes.php line 2047

at Symfony\Component\HttpKernel\Controller\ControllerResolver->getController(object(Request))
    in /opt/lampp/htdocs/my_projects/Symphony_projects/test/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php line 46

at Symfony\Component\HttpKernel\Controller\TraceableControllerResolver->getController(object(Request))
    in /opt/lampp/htdocs/my_projects/Symphony_projects/test/app/bootstrap.php.cache line 2969

at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
    in /opt/lampp/htdocs/my_projects/Symphony_projects/test/app/bootstrap.php.cache line 2938

at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
    in /opt/lampp/htdocs/my_projects/Symphony_projects/test/app/bootstrap.php.cache line 3087

at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
    in /opt/lampp/htdocs/my_projects/Symphony_projects/test/app/bootstrap.php.cache line 2337

at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
    in /opt/lampp/htdocs/my_projects/Symphony_projects/test/web/app_dev.php line 28