Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 to 3 #391

Merged
merged 3 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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