0

Check out lines #2 and #3 starting from bottom:

[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"}

Seems to me like it's making a duplicate query.

What should I do?

Elnur Abdurrakhimov
  • 44,533
  • 10
  • 148
  • 133
ChocoDeveloper
  • 14,160
  • 26
  • 79
  • 117
  • that's hard to track down without provided code.. Most IDE's support debugging with xDebug, you could follow each line beeing executed. PHPStorm, Eclipse.. choose your weapons and track this down :) – weyandch Sep 15 '12 at 07:22
  • You could enable the MongoDB [profiler](http://www.mongodb.org/display/DOCS/Database+Profiler) at a level of 2 (all queries) to confirm if there are actually double queries, or if this is just a logging anomaly. I'm not familiar with FOSUserBundle, but it's possible that it does do multiple (duplicate) queries as part of its logic. – Stennie Sep 17 '12 at 01:16

1 Answers1

0

Now I think it's not querying more than once, it's just how it logs. In other queries, there is 1 log line for each part of the query, but the dev toolbar shows it as 1 query, so it must be right.

ChocoDeveloper
  • 14,160
  • 26
  • 79
  • 117