Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/DataCollector/DoctrineMongoDBDataCollector.php b/src/Symfony/Bundle/DoctrineMongoDBBundle/DataCollector/DoctrineMongoDBDataC
index 0574ccf..ec89d40 100644
--- a/src/Symfony/Bundle/DoctrineMongoDBBundle/DataCollector/DoctrineMongoDBDataCollector.php
+++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/DataCollector/DoctrineMongoDBDataCollector.php
@@ -27,6 +27,7 @@ class DoctrineMongoDBDataCollector extends DataCollector
public function collect(Request $request, Response $response, \Exception $exception = null)
{
$this->data['nb_queries'] = $this->logger->getNbQueries();
+ $this->data['queries'] = $this->logger->getQueries();
}
public function getQueryCount()
@@ -34,6 +35,11 @@ class DoctrineMongoDBDataCollector extends DataCollector
return $this->data['nb_queries'];
}
+ public function getQueries()
+ {
+ return $this->data['queries'];
+ }
+
/**
* {@inheritdoc}
*/
diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/Logger/DoctrineMongoDBLogger.php b/src/Symfony/Bundle/DoctrineMongoDBBundle/Logger/DoctrineMongoDBLogger.php
index 5e4afb1..56f9d8c 100644
--- a/src/Symfony/Bundle/DoctrineMongoDBBundle/Logger/DoctrineMongoDBLogger.php
+++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/Logger/DoctrineMongoDBLogger.php
@@ -14,6 +14,7 @@ class DoctrineMongoDBLogger
{
protected $logger;
protected $nbQueries;
+ protected $queries = array();
public function __construct(LoggerInterface $logger = null)
{
@@ -28,6 +29,12 @@ class DoctrineMongoDBLogger
if (null !== $this->logger) {
$this->logger->info(static::formatQuery($query));
}
+ $this->queries[] = static::formatQuery($query);
+ }
+
+ public function getQueries()
+ {
+ return $this->queries;
}
public function getNbQueries()
diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/Resources/views/Profiler/mongodb_panel.php b/src/Symfony/Bundle/DoctrineMongoDBBundle/Resources/views/Profiler/mongodb_panel
index 2f426e2..8e08a27 100644
--- a/src/Symfony/Bundle/DoctrineMongoDBBundle/Resources/views/Profiler/mongodb_panel.php
+++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/Resources/views/Profiler/mongodb_panel.php
@@ -7,7 +7,7 @@
<?php foreach ($data->getQueries() as $i => $query): ?>
<li class="<?php echo $i % 2 ? 'odd' : 'even' ?>">
<div>
- <code><pre><?php var_dump($query) ?></pre></code>
+ <code><?php echo $query ?></code>
</div>
</li>
<?php endforeach; ?>
diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/Resources/views/Profiler/mongodb_menu.php b/src/Symfony/Bundle/DoctrineMongoDBBundle/Resources/views/Profiler/mongodb_menu.p
index a9f0653..397a25a 100644
--- a/src/Symfony/Bundle/DoctrineMongoDBBundle/Resources/views/Profiler/mongodb_menu.php
+++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/Resources/views/Profiler/mongodb_menu.php
@@ -1,2 +1,3 @@
+<div class="count"><?php echo $data->getQueryCount() ?></div>
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" alt="" src="<?php echo $view->get('assets')->getUrl('bundles/webprofiler/images/db.png') ?>" />
Doctrine MongoDB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment