Skip to content

Commit

Permalink
Rename doctrine.odm.mongodb to doctrine_mongodb.odm
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikbjorn committed Aug 1, 2012
1 parent aa03541 commit 66c5f0d
Show file tree
Hide file tree
Showing 20 changed files with 274 additions and 266 deletions.
13 changes: 9 additions & 4 deletions CHANGELOG-2.1.md
Expand Up @@ -7,15 +7,20 @@ in 2.1 minor versions.
2.1.0
-----

### Services

* The id for referencing the registry have been changed from `doctrine.odm.mongodb`
to `doctrine_mongodb`.

### Events

* The format for naming event manager services is now
`doctrine.odm.mongodb.%s_connection.event_manager` and uses the connection
`doctrine_mongodb.odm.%s_connection.event_manager` and uses the connection
name. The event manager shared by the default document manager is still
aliased as `doctrine.odm.mongodb.event_manager`.
aliased as `doctrine_mongodb.odm.event_manager`.
* Listeners and subscriber services must be tagged with
`doctrine.odm.mongodb.event_listener` and
`doctrine.odm.mongodb.event_subscriber`, respectively. By default, listeners
`doctrine_mongodb.odm.event_listener` and
`doctrine_mongodb.odm.event_subscriber`, respectively. By default, listeners
and subscribers will be registered with event managers for all connections,
unless the `connection` attribute is specified.
* Added `lazy` attribute to tags to request lazy loading of listener services
Expand Down
8 changes: 4 additions & 4 deletions CacheWarmer/HydratorCacheWarmer.php
Expand Up @@ -54,7 +54,7 @@ public function isOptional()
public function warmUp($cacheDir)
{
// we need the directory no matter the hydrator cache generation strategy.
$hydratorCacheDir = $this->container->getParameter('doctrine.odm.mongodb.hydrator_dir');
$hydratorCacheDir = $this->container->getParameter('doctrine_mongodb.odm.hydrator_dir');
if (!file_exists($hydratorCacheDir)) {
if (false === @mkdir($hydratorCacheDir, 0777, true)) {
throw new \RuntimeException(sprintf('Unable to create the Doctrine Hydrator directory (%s)', dirname($hydratorCacheDir)));
Expand All @@ -64,16 +64,16 @@ public function warmUp($cacheDir)
}

// if hydrators are autogenerated we don't need to generate them in the cache warmer.
if ($this->container->getParameter('doctrine.odm.mongodb.auto_generate_hydrator_classes') === true) {
if ($this->container->getParameter('doctrine_mongodb.odm.auto_generate_hydrator_classes') === true) {
return;
}

/* @var $registry \Doctrine\Common\Persistence\ManagerRegistry */
$registry = $this->container->get('doctrine.odm.mongodb');
$registry = $this->container->get('doctrine_mongodb');
foreach ($registry->getManagers() as $dm) {
/* @var $dm \Doctrine\ODM\MongoDB\DocumentManager */
$classes = $dm->getMetadataFactory()->getAllMetadata();
$dm->getHydratorFactory()->generateHydratorClasses($classes);
}
}
}
}
8 changes: 4 additions & 4 deletions CacheWarmer/ProxyCacheWarmer.php
Expand Up @@ -54,7 +54,7 @@ public function isOptional()
public function warmUp($cacheDir)
{
// we need the directory no matter the proxy cache generation strategy.
$proxyCacheDir = $this->container->getParameter('doctrine.odm.mongodb.proxy_dir');
$proxyCacheDir = $this->container->getParameter('doctrine_mongodb.odm.proxy_dir');
if (!file_exists($proxyCacheDir)) {
if (false === @mkdir($proxyCacheDir, 0777, true)) {
throw new \RuntimeException(sprintf('Unable to create the Doctrine Proxy directory (%s)', dirname($proxyCacheDir)));
Expand All @@ -64,16 +64,16 @@ public function warmUp($cacheDir)
}

// if proxies are autogenerated we don't need to generate them in the cache warmer.
if ($this->container->getParameter('doctrine.odm.mongodb.auto_generate_proxy_classes') === true) {
if ($this->container->getParameter('doctrine_mongodb.odm.auto_generate_proxy_classes') === true) {
return;
}

/* @var $registry \Doctrine\Common\Persistence\ManagerRegistry */
$registry = $this->container->get('doctrine.odm.mongodb');
$registry = $this->container->get('doctrine_mongodb');
foreach ($registry->getManagers() as $dm) {
/* @var $dm \Doctrine\ODM\MongoDB\DocumentManager */
$classes = $dm->getMetadataFactory()->getAllMetadata();
$dm->getProxyFactory()->generateProxyClasses($classes);
}
}
}
}
4 changes: 2 additions & 2 deletions Command/DoctrineODMCommand.php
Expand Up @@ -30,7 +30,7 @@ abstract class DoctrineODMCommand extends ContainerAwareCommand
{
public static function setApplicationDocumentManager(Application $application, $dmName)
{
$dm = $application->getKernel()->getContainer()->get('doctrine.odm.mongodb')->getManager($dmName);
$dm = $application->getKernel()->getContainer()->get('doctrine_mongodb')->getManager($dmName);
$helperSet = $application->getHelperSet();
$helperSet->set(new DocumentManagerHelper($dm), 'dm');
}
Expand All @@ -49,7 +49,7 @@ protected function getDocumentGenerator()

protected function getDoctrineDocumentManagers()
{
return $this->getContainer()->get('doctrine.odm.mongodb')->getManagers();
return $this->getContainer()->get('doctrine_mongodb')->getManagers();
}

protected function getBundleMetadatas(Bundle $bundle)
Expand Down
4 changes: 2 additions & 2 deletions Command/InfoDoctrineODMCommand.php
Expand Up @@ -49,10 +49,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$documentManagerName = $input->getOption('dm') ?
$input->getOption('dm') :
$this->getContainer()->get('doctrine.odm.mongodb')->getDefaultManagerName();
$this->getContainer()->get('doctrine_mongodb')->getDefaultManagerName();

/* @var $documentManager Doctrine\ODM\MongoDB\DocumentManager */
$documentManager = $this->getContainer()->get('doctrine.odm.mongodb')->getManager($documentManagerName);
$documentManager = $this->getContainer()->get('doctrine_mongodb')->getManager($documentManagerName);

$documentClassNames = $documentManager->getConfiguration()
->getMetadataDriverImpl()
Expand Down
2 changes: 1 addition & 1 deletion Command/LoadDataFixturesDoctrineODMCommand.php
Expand Up @@ -56,7 +56,7 @@ protected function configure()

protected function execute(InputInterface $input, OutputInterface $output)
{
$dm = $this->getContainer()->get('doctrine.odm.mongodb')->getManager($input->getOption('dm'));
$dm = $this->getContainer()->get('doctrine_mongodb')->getManager($input->getOption('dm'));
$dirOrFile = $input->getOption('fixtures');
if ($dirOrFile) {
$paths = is_array($dirOrFile) ? $dirOrFile : array($dirOrFile);
Expand Down
2 changes: 1 addition & 1 deletion Command/TailCursorDoctrineODMCommand.php
Expand Up @@ -44,7 +44,7 @@ protected function configure()

protected function execute(InputInterface $input, OutputInterface $output)
{
$dm = $this->getContainer()->get('doctrine.odm.mongodb.document_manager');
$dm = $this->getContainer()->get('doctrine_mongodb.odm.document_manager');
$repository = $dm->getRepository($input->getArgument('document'));
$repositoryReflection = new \ReflectionClass($repository);
$documentReflection = $repository->getDocumentManager()->getMetadataFactory()->getMetadataFor($input->getArgument('document'))->getReflectionClass();
Expand Down
6 changes: 3 additions & 3 deletions DependencyInjection/Compiler/CreateHydratorDirectoryPass.php
Expand Up @@ -21,15 +21,15 @@ class CreateHydratorDirectoryPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasParameter('doctrine.odm.mongodb.hydrator_dir')) {
if (!$container->hasParameter('doctrine_mongodb.odm.hydrator_dir')) {
return;
}
// Don't do anything if auto_generate_hydrator_classes is false
if (!$container->getParameter('doctrine.odm.mongodb.auto_generate_hydrator_classes')) {
if (!$container->getParameter('doctrine_mongodb.odm.auto_generate_hydrator_classes')) {
return;
}
// Create document proxy directory
$hydratorCacheDir = $container->getParameter('doctrine.odm.mongodb.hydrator_dir');
$hydratorCacheDir = $container->getParameter('doctrine_mongodb.odm.hydrator_dir');
if (!is_dir($hydratorCacheDir)) {
if (false === @mkdir($hydratorCacheDir, 0777, true)) {
exit(sprintf('Unable to create the Doctrine Hydrator directory (%s)', dirname($hydratorCacheDir)));
Expand Down
6 changes: 3 additions & 3 deletions DependencyInjection/Compiler/CreateProxyDirectoryPass.php
Expand Up @@ -21,15 +21,15 @@ class CreateProxyDirectoryPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasParameter('doctrine.odm.mongodb.proxy_dir')) {
if (!$container->hasParameter('doctrine_mongodb.odm.proxy_dir')) {
return;
}
// Don't do anything if auto_generate_proxy_classes is false
if (!$container->getParameter('doctrine.odm.mongodb.auto_generate_proxy_classes')) {
if (!$container->getParameter('doctrine_mongodb.odm.auto_generate_proxy_classes')) {
return;
}
// Create document proxy directory
$proxyCacheDir = $container->getParameter('doctrine.odm.mongodb.proxy_dir');
$proxyCacheDir = $container->getParameter('doctrine_mongodb.odm.proxy_dir');
if (!is_dir($proxyCacheDir)) {
if (false === @mkdir($proxyCacheDir, 0777, true)) {
exit(sprintf('Unable to create the Doctrine Proxy directory (%s)', dirname($proxyCacheDir)));
Expand Down

0 comments on commit 66c5f0d

Please sign in to comment.