FOSUserBundle正在查询两次以获取用户

时间:2012-09-15 02:28:45

标签: mongodb symfony symfony-2.1 fosuserbundle monolog

从底部开始检查第2行和第3行:

[2012-09-11 16:44:55] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest". [] {"token":"504f6a8727898"}
[2012-09-11 16:44:55] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest". [] {"token":"504f6a8727898"}
[2012-09-11 16:44:55] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest". [] {"token":"504f6a8727898"}
[2012-09-11 16:44:55] request.INFO: Matched route "myapp_main_default_index" (parameters: "_controller": "Myapp\MainBundle\Controller\DefaultController::indexAction", "_route": "myapp_main_default_index") [] {"token":"504f6a8727898"}
[2012-09-11 16:44:55] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest". [] {"token":"504f6a8727898"}
[2012-09-11 16:44:55] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". [] {"token":"504f6a8727898"}
[2012-09-11 16:44:55] security.DEBUG: Read SecurityContext from the session [] {"token":"504f6a8727898"}
[2012-09-11 16:44:55] security.DEBUG: Reloading user from user provider. [] {"token":"504f6a8727898"}
[2012-09-11 16:44:55] doctrine.INFO: MongoDB query: {"find":true,"query":{"_id":{"$id":"504f548c8c2d892617000000"}},"fields":[],"db":"myapp_db","collection":"User"} [] {"token":"504f6a8727898"}
[2012-09-11 16:44:55] doctrine.INFO: MongoDB query: {"limit":true,"limitNum":1,"query":{"_id":{"$id":"504f548c8c2d892617000000"}},"fields":[]} [] {"token":"504f6a8727898"}
[2012-09-11 16:44:55] doctrine.INFO: MongoDB query: {"limit":true,"limitNum":1,"query":{"_id":{"$id":"504f548c8c2d892617000000"}},"fields":[]} [] {"token":"504f6a8727898"}
[2012-09-11 16:44:55] security.DEBUG: Username "test" was reloaded from user provider. [] {"token":"504f6a8727898"}

对我而言似乎正在进行重复查询。

我该怎么办?

1 个答案:

答案 0 :(得分:0)

现在我认为它不是不止一次查询,而是它的记录方式。在其他查询中,查询的每个部分都有1个日志行,但开发工具栏将其显示为1个查询,因此它必须是正确的。