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

This commit is contained in:
Bulat Shakirzyanov 2011-01-06 17:45:48 -05:00 committed by Fabien Potencier
parent d693759312
commit 92653bf827

View File

@ -68,11 +68,10 @@ class DoctrineMongoDBLogger
* *
* @return string A serialized object for the log * @return string A serialized object for the log
*/ */
static protected function formatQuery(array $query) static protected function formatQuery(array $query, $array = true)
{ {
$parts = array(); $parts = array();
$array = true;
foreach ($query as $key => $value) { foreach ($query as $key => $value) {
if (!is_numeric($key)) { if (!is_numeric($key)) {
$array = false; $array = false;
@ -98,6 +97,8 @@ class DoctrineMongoDBLogger
$formatted = 'new MaxKey()'; $formatted = 'new MaxKey()';
} elseif ($value instanceof \MongoBinData) { } elseif ($value instanceof \MongoBinData) {
$formatted = 'new BinData("'.$value->bin.'", "'.$value->type.'")'; $formatted = 'new BinData("'.$value->bin.'", "'.$value->type.'")';
} elseif ($value instanceof \stdClass) {
$formatted = static::formatQuery((array) $value, false);
} else { } else {
$formatted = (string) $value; $formatted = (string) $value;
} }