[DoctrineBridge] DoctrineDataCollector comments the non runnable part of the query
This commit is contained in:
parent
03af7b93ad
commit
42760d0d7f
@ -162,8 +162,8 @@ class DoctrineDataCollector extends DataCollector
|
||||
$className = get_class($var);
|
||||
|
||||
return method_exists($var, '__toString') ?
|
||||
array(sprintf('Object(%s): "%s"', $className, $var->__toString()), false) :
|
||||
array(sprintf('Object(%s)', $className), false);
|
||||
array(sprintf('/* Object(%s): */"%s"', $className, $var->__toString()), false) :
|
||||
array(sprintf('/* Object(%s) */', $className), false);
|
||||
}
|
||||
|
||||
if (is_array($var)) {
|
||||
@ -179,7 +179,7 @@ class DoctrineDataCollector extends DataCollector
|
||||
}
|
||||
|
||||
if (is_resource($var)) {
|
||||
return array(sprintf('Resource(%s)', get_resource_type($var)), false);
|
||||
return array(sprintf('/* Resource(%s) */', get_resource_type($var)), false);
|
||||
}
|
||||
|
||||
return array($var, true);
|
||||
|
@ -45,7 +45,7 @@ class MergeDoctrineCollectionListener implements EventSubscriberInterface
|
||||
|
||||
// If all items were removed, call clear which has a higher
|
||||
// performance on persistent collections
|
||||
if ($collection instanceof Collection && count($data) === 0) {
|
||||
if ($collection instanceof Collection && 0 === count($data)) {
|
||||
$collection->clear();
|
||||
}
|
||||
}
|
||||
|
@ -126,12 +126,12 @@ class DoctrineDataCollectorTest extends TestCase
|
||||
array(true, array(), true, true),
|
||||
array(null, array(), null, true),
|
||||
array(new \DateTime('2011-09-11'), array('date'), '2011-09-11', true),
|
||||
array(fopen(__FILE__, 'r'), array(), 'Resource(stream)', false),
|
||||
array(new \stdClass(), array(), 'Object(stdClass)', false),
|
||||
array(fopen(__FILE__, 'r'), array(), '/* Resource(stream) */', false),
|
||||
array(new \stdClass(), array(), '/* Object(stdClass) */', false),
|
||||
array(
|
||||
new StringRepresentableClass(),
|
||||
array(),
|
||||
'Object(Symfony\Bridge\Doctrine\Tests\DataCollector\StringRepresentableClass): "string representation"',
|
||||
'/* Object(Symfony\Bridge\Doctrine\Tests\DataCollector\StringRepresentableClass): */"string representation"',
|
||||
false,
|
||||
),
|
||||
);
|
||||
|
Reference in New Issue
Block a user