[DoctrineMongoDBBundle] made it possible to disable logging
This commit is contained in:
parent
e0b46fea73
commit
7b3fbb46c2
@ -12,10 +12,21 @@ use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
*/
|
||||
class Configuration
|
||||
{
|
||||
private $debug;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Boolean $debug The kernel.debug value
|
||||
*/
|
||||
public function __construct($debug)
|
||||
{
|
||||
$this->debug = (Boolean) $debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the configuration tree.
|
||||
*
|
||||
* @param boolean $kernelDebug The kernel.debug DIC parameter
|
||||
* @return \Symfony\Component\DependencyInjection\Configuration\NodeInterface
|
||||
*/
|
||||
public function getConfigTree()
|
||||
@ -54,6 +65,7 @@ class Configuration
|
||||
->builder($this->getMetadataCacheDriverNode())
|
||||
->scalarNode('connection')->end()
|
||||
->scalarNode('database')->end()
|
||||
->booleanNode('logging')->defaultValue($this->debug)->end()
|
||||
->fixXmlConfig('mapping')
|
||||
->builder($this->getMappingsNode())
|
||||
->end()
|
||||
|
@ -66,7 +66,7 @@ class DoctrineMongoDBExtension extends AbstractDoctrineExtension
|
||||
$loader->load('mongodb.xml');
|
||||
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration();
|
||||
$configuration = new Configuration($container->getParameter('kernel.debug'));
|
||||
$config = $processor->process($configuration->getConfigTree(), $configs);
|
||||
|
||||
// can't currently default this correctly in Configuration
|
||||
@ -177,8 +177,12 @@ class DoctrineMongoDBExtension extends AbstractDoctrineExtension
|
||||
'setHydratorNamespace' => '%doctrine.odm.mongodb.hydrator_namespace%',
|
||||
'setAutoGenerateHydratorClasses' => '%doctrine.odm.mongodb.auto_generate_hydrator_classes%',
|
||||
'setDefaultDB' => $defaultDatabase,
|
||||
'setLoggerCallable' => array(new Reference('doctrine.odm.mongodb.logger'), 'logQuery'),
|
||||
);
|
||||
|
||||
if ($documentManager['logging']) {
|
||||
$methods['setLoggerCallable'] = array(new Reference('doctrine.odm.mongodb.logger'), 'logQuery');
|
||||
}
|
||||
|
||||
foreach ($methods as $method => $arg) {
|
||||
if ($odmConfigDef->hasMethodCall($method)) {
|
||||
$odmConfigDef->removeMethodCall($method);
|
||||
|
Reference in New Issue
Block a user