Skip to content

Commit

Permalink
Merge pull request #391 from doctrine/2-to-3
Browse files Browse the repository at this point in the history
2 to 3
  • Loading branch information
dbu authored Jan 8, 2024
2 parents 2a941be + e40d208 commit 71177c7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
23 changes: 23 additions & 0 deletions src/DependencyInjection/Compiler/DoctrinePhpcrMappingsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/config/odm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<parameter key="doctrine_phpcr.odm.metadata.php.class">Doctrine\Persistence\Mapping\Driver\StaticPHPDriver</parameter>
<parameter key="doctrine_phpcr.odm.metadata.driver_chain.class">Doctrine\Persistence\Mapping\Driver\MappingDriverChain</parameter>
<parameter key="doctrine_phpcr.odm.metadata.annotation.class">Doctrine\ODM\PHPCR\Mapping\Driver\AnnotationDriver</parameter>
<parameter key="doctrine_phpcr.odm.metadata.attribute.class">Doctrine\ODM\PHPCR\Mapping\Driver\AttributeDriver</parameter>
</parameters>
<services>

Expand All @@ -42,6 +43,7 @@
</service>

<service id="doctrine_phpcr.odm.metadata.annotation_reader" alias="annotation_reader" public="false" />
<service id="doctrine_phpcr.odm.metadata.attribute_reader" alias="attribute_reader" public="false" />

<service
id="doctrine_phpcr.odm.configuration"
Expand Down

0 comments on commit 71177c7

Please sign in to comment.