瀏覽代碼

[DoctrineMongoDBBundle] updated logging to support new embedded document in \stdClass

Bulat Shakirzyanov 14 年之前
父節點
當前提交
92653bf827
共有 1 個文件被更改,包括 6 次插入5 次删除
  1. 6 5
      src/Symfony/Bundle/DoctrineMongoDBBundle/Logger/DoctrineMongoDBLogger.php

+ 6 - 5
src/Symfony/Bundle/DoctrineMongoDBBundle/Logger/DoctrineMongoDBLogger.php

@@ -7,7 +7,7 @@ use Symfony\Component\Yaml\Yaml;
 
 /**
  * Logger for the Doctrine MongoDB ODM.
- * 
+ *
  * @author Kris Wallsmith <kris.wallsmith@symfony-project.com>
  */
 class DoctrineMongoDBLogger
@@ -63,16 +63,15 @@ class DoctrineMongoDBLogger
 
     /**
      * Formats the supplied query array recursively.
-     * 
+     *
      * @param array $query All or part of a query array
-     * 
+     *
      * @return string A serialized object for the log
      */
-    static protected function formatQuery(array $query)
+    static protected function formatQuery(array $query, $array = true)
     {
         $parts = array();
 
-        $array = true;
         foreach ($query as $key => $value) {
             if (!is_numeric($key)) {
                 $array = false;
@@ -98,6 +97,8 @@ class DoctrineMongoDBLogger
                 $formatted = 'new MaxKey()';
             } elseif ($value instanceof \MongoBinData) {
                 $formatted = 'new BinData("'.$value->bin.'", "'.$value->type.'")';
+            } elseif ($value instanceof \stdClass) {
+                $formatted = static::formatQuery((array) $value, false);
             } else {
                 $formatted = (string) $value;
             }