Skip to content

mitrii/spiral-doctrine-odm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Doctrine ODM connector for Spiral Framework

Configuration

Create config file in app/config/doctrine_odm.php:

Mongo uri and options details see here

Minimal config:

<?php

return [
    'uri' => 'mongodb://mongodb:27017',
];

All config options:

<?php

return [
        'uri' => 'mongodb://mongodb:27017',
        'uriOptions' => [],
        'defaultDatabase' =>  'db',
        'driverOptions' => [
            'typeMap' => DocumentManager::CLIENT_TYPEMAP,
        ],
        'mappingDriver' => \Doctrine\ODM\MongoDB\Mapping\Driver\AttributeDriver::class,
        
        'proxyDir' => '/runtime/doctrine/proxies',
        'proxyNamespace' => 'DoctrineProxies',
        'autoGenerateProxyClasses' => Configuration::AUTOGENERATE_FILE_NOT_EXISTS,
        
        'hydratorDir' => '/runtime/doctrine/hydrators',
        'hydratorNamespace' => 'DoctrineHydrators',
        'autoGenerateHydratorClasses' => Configuration::AUTOGENERATE_FILE_NOT_EXISTS,
        
        'defaultRepositoryClassName' => DocumentRepository::class,
];

Add Doctrine console commands

// app/config/console.php

//...

    'commands'  => [
        \Doctrine\ODM\MongoDB\Tools\Console\Command\GenerateProxiesCommand::class,
        \Doctrine\ODM\MongoDB\Tools\Console\Command\QueryCommand::class,
        \Doctrine\ODM\MongoDB\Tools\Console\Command\ClearCache\MetadataCommand::class,
        \Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\CreateCommand::class,
        \Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\DropCommand::class,
        \Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\UpdateCommand::class,
        \Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\ShardCommand::class,
    ],
    
// ...    

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages