diff --git a/composer.json b/composer.json index ecfec36d..a5e96197 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,7 @@ "symfony/form": "^5.4 || ^6.0", "symfony/monolog-bridge": "^5.4 || ^6.0", "symfony/monolog-bundle": "^3.4", - "symfony/phpunit-bridge": "^5.4 || ^6.0", + "symfony/phpunit-bridge": "^v6.4.2 || ^v7.0.2", "symfony/templating": "^5.4 || ^6.0", "symfony/translation": "^5.4 || ^6.0", "symfony/twig-bundle": "^5.4 || ^6.0", diff --git a/src/DependencyInjection/Compiler/DoctrinePhpcrMappingsPass.php b/src/DependencyInjection/Compiler/DoctrinePhpcrMappingsPass.php index c4ee5888..d78c64a7 100644 --- a/src/DependencyInjection/Compiler/DoctrinePhpcrMappingsPass.php +++ b/src/DependencyInjection/Compiler/DoctrinePhpcrMappingsPass.php @@ -3,6 +3,7 @@ namespace Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler; use Doctrine\ODM\PHPCR\Mapping\Driver\AnnotationDriver; +use Doctrine\ODM\PHPCR\Mapping\Driver\AttributeDriver; use Doctrine\ODM\PHPCR\Mapping\Driver\XmlDriver; use Doctrine\ODM\PHPCR\Mapping\Driver\YamlDriver; use Doctrine\Persistence\Mapping\Driver\PHPDriver; @@ -146,6 +147,28 @@ public static function createAnnotationMappingDriver( return new self($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap); } + /** + * @param string[] $namespaces List of namespaces that are handled with annotation mapping + * @param string[] $directories List of directories to look for annotated classes + * @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 + * @param bool $reportFieldsWhereDeclared Will report fields for the classes where they are declared + * + * @return self + */ + public static function createAttributeMappingDriver(array $namespaces, array $directories, array $managerParameters = [], $enabledParameter = false, array $aliasMap = [], bool $reportFieldsWhereDeclared = false) + { + $driver = new Definition(AttributeDriver::class, [$directories, $reportFieldsWhereDeclared]); + + return new self($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/src/Resources/config/odm.xml b/src/Resources/config/odm.xml index 7826ff64..72e36b4c 100644 --- a/src/Resources/config/odm.xml +++ b/src/Resources/config/odm.xml @@ -24,6 +24,7 @@ Doctrine\Persistence\Mapping\Driver\StaticPHPDriver Doctrine\Persistence\Mapping\Driver\MappingDriverChain Doctrine\ODM\PHPCR\Mapping\Driver\AnnotationDriver + Doctrine\ODM\PHPCR\Mapping\Driver\AttributeDriver @@ -42,6 +43,7 @@ +