Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add ClassMetadataFactoryName to config options #58

Merged
merged 4 commits into from

2 participants

@superdweebie
Collaborator

This is a configuration option available in doctrine mongo odm, but not exposed in the zf2 module.

...ctrineMongoODMModule/Service/ConfigurationFactory.php
((6 lines not shown))
$config->setMetadataDriverImpl($serviceLocator->get($options->getDriver()));
+ // metadataFactory, if set
+ $factoryName = $options->getClassMetadataFactoryName();
+ if (isset($factoryName)){
@Ocramius Owner

if ($factoryName = $options->getClassMetadataFactoryName()) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Ocramius
Owner

Is this a new ODM feature?

@superdweebie
Collaborator

I don't think it's new. I don't know when it was added.

@Ocramius
Owner

Is there any clue on what this does? O_o

@superdweebie
Collaborator

It lets you set the class used for the ClassMetadataFactory. That factory class is the one that creates all the ClassMetadata instance's. So, if you want to extend ClassMetadata, you override the factory, an then tell the config to use the your new factory.

@Ocramius
Owner

@superdweebie do you happen to know how to get travis to build something working again? :)

src/DoctrineMongoODMModule/Options/Configuration.php
@@ -312,4 +318,13 @@ public function getLogger()
{
return $this->logger;
}
+
+ public function getClassMetadataFactoryName() {
@Ocramius Owner

Can you please add docblocks for these methods?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@superdweebie
Collaborator

I have no idea why Travis is failing ??

@Ocramius Ocramius merged commit 3a652cf into doctrine:master
@Ocramius
Owner

@superdweebie opened #59 for that. Thank you so far!

@superdweebie superdweebie deleted the unknown repository branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 11, 2013
  1. @superdweebie

    Add more config support

    superdweebie authored
Commits on Feb 12, 2013
  1. @superdweebie
  2. @superdweebie

    Improve code style

    superdweebie authored
  3. @superdweebie

    Add docblocks

    superdweebie authored
This page is out of date. Refresh to see the latest.
View
2  config/module.config.php
@@ -30,6 +30,8 @@
'default_db' => null,
'filters' => array() // array('filterName' => 'BSON\Filter\Class')
+
+ //'classMetadataFactoryName' => 'ClassName'
)
),
View
23 src/DoctrineMongoODMModule/Options/Configuration.php
@@ -110,6 +110,12 @@ class Configuration extends AbstractOptions
/**
*
+ * @var string
+ */
+ protected $classMetadataFactoryName;
+
+ /**
+ *
* @param string $driver
* @return \DoctrineMongoODMModule\Options\Configuration
*/
@@ -312,4 +318,21 @@ public function getLogger()
{
return $this->logger;
}
+
+ /**
+ *
+ * @return string
+ */
+ public function getClassMetadataFactoryName() {
+ return $this->classMetadataFactoryName;
+ }
+
+ /**
+ *
+ * @param string $classMetadataFactoryName
+ */
+ public function setClassMetadataFactoryName($classMetadataFactoryName) {
+ $this->classMetadataFactoryName = (string) $classMetadataFactoryName;
+ }
+
}
View
8 src/DoctrineMongoODMModule/Service/ConfigurationFactory.php
@@ -18,7 +18,6 @@
*/
namespace DoctrineMongoODMModule\Service;
-use Doctrine\Common\Annotations\AnnotationRegistry;
use DoctrineModule\Service\AbstractFactory;
use Doctrine\ODM\MongoDB\Configuration;
use Zend\ServiceManager\ServiceLocatorInterface;
@@ -73,9 +72,14 @@ public function createService(ServiceLocatorInterface $serviceLocator)
$config->addFilter($alias, $class);
}
- // finally, the driver
+ // the driver
$config->setMetadataDriverImpl($serviceLocator->get($options->getDriver()));
+ // metadataFactory, if set
+ if ($factoryName = $options->getClassMetadataFactoryName()){
+ $config->setClassMetadataFactoryName($factoryName);
+ }
+
return $config;
}
Something went wrong with that request. Please try again.