[MODM-143] Mismatch in configuration classes, can't enable logging Created: 11/May/11  Updated: 16/May/11  Resolved: 16/May/11

Status: Resolved
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA3
Fix Version/s: None

Type: Bug Priority: Trivial
Reporter: Stanislav Korchagin Assignee: Jonathan H. Wage
Resolution: Fixed Votes: 0
Labels: None


 Description   

My bootstrap:

 
        $config = new Doctrine\ODM\MongoDB\Configuration();
        $config->setProxyDir(APPLICATION_PATH . '/../data/cache');
        $config->setProxyNamespace('Proxies');
        $config->setDefaultDB([skip]);

        $config->setHydratorDir(APPLICATION_PATH . '/../data/cache');
        $config->setHydratorNamespace('Hydrators');

        $config->setLoggerCallable(function(array $log) { print_r($log); });

        $reader = new \Doctrine\Common\Annotations\AnnotationReader();
        $reader->setDefaultAnnotationNamespace('Doctrine\ODM\MongoDB\Mapping\\');
        $config->setMetadataDriverImpl(
            new \Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver($reader, __DIR__ . '/Documents')
        );

        $manager = \Doctrine\ODM\MongoDB\DocumentManager::create(
            new \Doctrine\MongoDB\Connection(),
            $config
        );

And nothing happens

Trace from Doctrine\MongoDB\Configuration::getLoggerCallable():

#0 [skip]/Doctrine/MongoDB/Connection.php(248): Doctrine\MongoDB\Configuration->getLoggerCallable()
#1 [skip]/Doctrine/MongoDB/Connection.php(231): Doctrine\MongoDB\Connection->wrapDatabase(Object(MongoDB))
#2 [skip]/Doctrine/ODM/MongoDB/DocumentManager.php(287): Doctrine\MongoDB\Connection->selectDatabase([skip])
#3 [skip]/Doctrine/ODM/MongoDB/DocumentManager.php(316): Doctrine\ODM\MongoDB\DocumentManager->getDocumentDatabase('BPM\User')
#4 [skip]/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php(148): Doctrine\ODM\MongoDB\DocumentManager->getDocumentCollection('BPM\User')
#5 [skip]/Doctrine/ODM/MongoDB/UnitOfWork.php(319): Doctrine\ODM\MongoDB\Persisters\DocumentPersister->__construct(Object(Doctrine\ODM\MongoDB\Persisters\PersistenceBuilder), Object(Doctrine\ODM\MongoDB\DocumentManager), Object(Doctrine\Common\EventManager), Object(Doctrine\ODM\MongoDB\UnitOfWork), Object(Doctrine\ODM\MongoDB\Hydrator\HydratorFactory), Object(Doctrine\ODM\MongoDB\Mapping\ClassMetadata), '$')
#6 [skip]/Doctrine/ODM/MongoDB/DocumentRepository.php(115): Doctrine\ODM\MongoDB\UnitOfWork->getDocumentPersister('BPM\User')
#7 [skip]application/library/BPM/UserData.php(43): Doctrine\ODM\MongoDB\DocumentRepository->find('4dc9d0192d91365...')
[skip]

get_class($this) from Doctrine\MongoDB\Configuration::setLoggerCallable() write 'Doctrine\ODM\MongoDB\Configuration' like expected, but in getLoggerCallable() write 'Doctrine\MongoDB\Configuration'

Do you have any ideas about this behaviour?



 Comments   
Comment by Stanislav Korchagin [ 16/May/11 ]

The error was in my bootstrap code:

- $manager = \Doctrine\ODM\MongoDB\DocumentManager::create(
-           new \Doctrine\MongoDB\Connection(),
-            $config
-        );
+ $manager = \Doctrine\ODM\MongoDB\DocumentManager::create(
+           null,
+            $config
+        );

But confusion still exists, because I used an example from the documentation (http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/introduction.html#setup).

Generated at Tue Sep 30 12:21:55 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.