[DoctrineMongoDBBundle] fixed logging of null values

This commit is contained in:
Kris Wallsmith 2011-04-07 13:51:25 -07:00
parent 3dfbc08d73
commit e4d3045925
2 changed files with 5 additions and 3 deletions

View File

@ -248,7 +248,9 @@ class DoctrineMongoDBLogger
$array = false;
}
if (is_bool($value)) {
if (null === $value) {
$formatted = 'null';
} elseif (is_bool($value)) {
$formatted = $value ? 'true' : 'false';
} elseif (is_numeric($value)) {
$formatted = $value;

View File

@ -42,8 +42,8 @@ class DoctrineMongoDBLoggerTest extends \PHPUnit_Framework_TestCase
),
// find
array(
array('db' => 'foo', 'collection' => 'bar', 'find' => true, 'query' => array(), 'fields' => array()),
array('use foo;', 'db.bar.find();'),
array('db' => 'foo', 'collection' => 'bar', 'find' => true, 'query' => array('foo' => null), 'fields' => array()),
array('use foo;', 'db.bar.find({ "foo": null });'),
),
);
}