diff --git a/DependencyInjection/Compiler/DoctrineMongoDBMappingsPass.php b/DependencyInjection/Compiler/DoctrineMongoDBMappingsPass.php
index e15f6f89..03e7df08 100644
--- a/DependencyInjection/Compiler/DoctrineMongoDBMappingsPass.php
+++ b/DependencyInjection/Compiler/DoctrineMongoDBMappingsPass.php
@@ -5,6 +5,7 @@
namespace Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler;
use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
+use Doctrine\ODM\MongoDB\Mapping\Driver\AttributeDriver;
use Doctrine\ODM\MongoDB\Mapping\Driver\XmlDriver;
use Doctrine\Persistence\Mapping\Driver\PHPDriver;
use Doctrine\Persistence\Mapping\Driver\StaticPHPDriver;
@@ -112,6 +113,27 @@ public static function createAnnotationMappingDriver(array $namespaces, array $d
return new DoctrineMongoDBMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap);
}
+ /**
+ * @param array $namespaces List of namespaces that are handled with attribute mapping
+ * @param array $directories List of directories to look for attribute mapping files
+ * @param string[] $managerParameters List of parameters that could which object manager name
+ * your bundle uses. This compiler pass will automatically
+ * append the parameter name for the default entity manager
+ * to this list.
+ * @param string|false $enabledParameter Service container parameter that must be present to
+ * enable the mapping. Set to false to not do any check,
+ * optional.
+ * @param string[] $aliasMap Map of alias to namespace.
+ *
+ * @return DoctrineMongoDBMappingsPass
+ */
+ public static function createAttributeMappingDriver(array $namespaces, array $directories, array $managerParameters, $enabledParameter = false, array $aliasMap = [])
+ {
+ $driver = new Definition(AttributeDriver::class, [$directories, new Reference('doctrine_mongodb.odm.metadata.attribute_reader')]);
+
+ return new DoctrineMongoDBMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap);
+ }
+
/**
* @param array $namespaces List of namespaces that are handled with static php mapping
* @param array $directories List of directories to look for static php mapping files
diff --git a/Resources/config/mongodb.xml b/Resources/config/mongodb.xml
index 82e43695..6b5342e5 100644
--- a/Resources/config/mongodb.xml
+++ b/Resources/config/mongodb.xml
@@ -32,6 +32,8 @@
Doctrine\Persistence\Mapping\Driver\MappingDriverChain
Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver
+ Doctrine\ODM\MongoDB\Mapping\Driver\AttributeDriver
+ Doctrine\ODM\MongoDB\Mapping\Driver\AttributeReader
Doctrine\Bundle\MongoDBBundle\Mapping\Driver\XmlDriver
@@ -115,6 +117,11 @@
%doctrine_mongodb.odm.document_dirs%
+
+ %doctrine_mongodb.odm.document_dirs%
+
+
+
%doctrine_mongodb.odm.xml_mapping_dirs%