Php Symfony2:kernel.request,onKernelRequest未加载

Php Symfony2:kernel.request,onKernelRequest未加载,php,symfony,Php,Symfony,我主要在每个bundle kernel.request中使用,所有东西都可以找到,但不是在一个包中 services.yml如下所示: services: crm.addressbook.country_manager: class: CRM\AddressBookBundle\Country\CountryManager arguments: [ @doctrine.orm.dynamic_entity_manager ] tags:

我主要在每个bundle kernel.request中使用,所有东西都可以找到,但不是在一个包中

services.yml如下所示:

services:
    crm.addressbook.country_manager:
        class: CRM\AddressBookBundle\Country\CountryManager
        arguments: [ @doctrine.orm.dynamic_entity_manager ]
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
乡村经理:

namespace CRM\AddressBookBundle\Country;

use Doctrine\ORM\EntityManager;
use Symfony\Component\Security\Core\SecurityContext;

class CountryManager {

    protected $em;
    protected static $country;

    public function __construct(EntityManager $em)
    {
        $this->em = $em;
    }

    public function onKernelRequest()
    {
        $this->loadCountry();
    }

    private function loadCountry()
    {
        $country = $this->em->getRepository('CRMAddressBookBundle:CountryLang')->findAll();

        foreach($country as $row)
        {
            self::$country[$row->getCountry()->getId()] = $row->getName();
        }
    }

}

有人知道会出什么问题吗?我没有得到任何错误。它只是没有启动代码…

尝试给它更多的优先级:
{name:kernel.event\u侦听器,event:kernel.request,method:onKernelRequest,priority:255}
。但是,它应该出现在探查器状态栏中。不,这也不起作用。它显示在探查器的侦听器部分吗?它应该出现在那里。如果没有,可能是您没有正确注册您的侦听器,或者另一个侦听器正在停止传播,这听起来很奇怪,但似乎有道理。在运行
app/console container:debug
时,容器中是否存在服务?否则,将无法正确加载服务配置文件。“是否有其他更好的方法直接从所有捆绑包中包含所有服务?”-是的,通过将它们加载到捆绑包扩展名中。