setDocumentManager() public method

Sets the DocumentManager instance for this class.
public setDocumentManager ( DocumentManager $dm )
$dm Doctrine\ODM\MongoDB\DocumentManager The DocumentManager instance
 public function setUp()
 {
     parent::setUp();
     $this->factory = new ClassMetadataFactory();
     $this->factory->setDocumentManager($this->dm);
     $this->factory->setConfiguration($this->dm->getConfiguration());
 }
    /**
     * Creates a new Document that operates on the given Mongo connection
     * and uses the given Configuration.
     *
     * @param Doctrine\MongoDB\Connection $conn
     * @param Doctrine\ODM\MongoDB\Configuration $config
     * @param Doctrine\Common\EventManager $eventManager
     */
    protected function __construct(Connection $conn = null, Configuration $config = null, EventManager $eventManager = null)
    {
        $this->config = $config ?: new Configuration();
        $this->eventManager = $eventManager ?: new EventManager();
        $this->cmd = $this->config->getMongoCmd();
        $this->connection = $conn ?: new Connection(null, array(), $this->config, $this->eventManager);

        $metadataFactoryClassName = $this->config->getClassMetadataFactoryName();
        $this->metadataFactory = new $metadataFactoryClassName();
        $this->metadataFactory->setDocumentManager($this);
        $this->metadataFactory->setConfiguration($this->config);
        if ($cacheDriver = $this->config->getMetadataCacheImpl()) {
            $this->metadataFactory->setCacheDriver($cacheDriver);
        }

        $hydratorDir = $this->config->getHydratorDir();
        $hydratorNs = $this->config->getHydratorNamespace();
        $this->hydratorFactory = new HydratorFactory(
          $this,
          $this->eventManager,
          $hydratorDir,
          $hydratorNs,
          $this->config->getAutoGenerateHydratorClasses(),
          $this->config->getMongoCmd()
        );

        $this->unitOfWork = new UnitOfWork($this, $this->eventManager, $this->hydratorFactory, $this->cmd);
        $this->hydratorFactory->setUnitOfWork($this->unitOfWork);
        $this->schemaManager = new SchemaManager($this, $this->metadataFactory);
        $this->proxyFactory = new ProxyFactory($this,
                $this->config->getProxyDir(),
                $this->config->getProxyNamespace(),
                $this->config->getAutoGenerateProxyClasses()
        );
    }
 public function testHasGetMetadata_NamespaceSeperatorIsNotNormalized()
 {
     require_once __DIR__ . "/Documents/GlobalNamespaceDocument.php";
     $driver = AnnotationDriver::create(__DIR__ . '/Documents');
     $dm = $this->getMockDocumentManager($driver);
     $cmf = new ClassMetadataFactory();
     $cmf->setConfiguration($dm->getConfiguration());
     $cmf->setDocumentManager($dm);
     $m1 = $cmf->getMetadataFor("DoctrineGlobal_Article");
     $h1 = $cmf->hasMetadataFor("DoctrineGlobal_Article");
     $h2 = $cmf->hasMetadataFor("\\DoctrineGlobal_Article");
     $m2 = $cmf->getMetadataFor("\\DoctrineGlobal_Article");
     $this->assertNotSame($m1, $m2);
     $this->assertFalse($h2);
     $this->assertTrue($h1);
 }
 public function setUp()
 {
     $this->dm = $this->getMockDocumentManager();
     $cmf = new ClassMetadataFactory();
     $cmf->setConfiguration($this->dm->getConfiguration());
     $cmf->setDocumentManager($this->dm);
     $map = array();
     foreach ($cmf->getAllMetadata() as $cm) {
         $this->documentCollections[$cm->name] = $this->getMockCollection();
         $this->documentDatabases[$cm->name] = $this->getMockDatabase();
         $this->classMetadatas[$cm->name] = $cm;
     }
     $this->dm->unitOfWork = $this->getMockUnitOfWork();
     $this->dm->metadataFactory = $cmf;
     $this->dm->documentCollections = $this->documentCollections;
     $this->dm->documentDatabases = $this->documentDatabases;
     $this->schemaManager = new SchemaManager($this->dm, $cmf);
     $this->dm->schemaManager = $this->schemaManager;
 }
 /**
  * {@inheritdoc}
  */
 public function setDocumentManager(DocumentManager $dm)
 {
     parent::setDocumentManager($dm);
     $this->documentManager = $dm;
 }