Skip to content

Commit

Permalink
Merge pull request #409 from doctrine/fix-phpcr-odm-bc-break
Browse files Browse the repository at this point in the history
Fix BC break in PHPCR-ODM: we must no longer call the removed addDocumentNamespace method
  • Loading branch information
dbu authored Aug 2, 2024
2 parents a87ccf5 + dc82197 commit 799c24d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Changelog
Version 3
=========

3.0.2
-----

* Fixed `DoctrinePhpcrMappingPass` to not configure the `addDocumentNamespace` method which has been removed in PHPCR-ODM 2.0.
* [BC Break] Removed the `$aliasMap` parameter from `DoctrinePhpcrMappingPass` because this functionality has been removed in PHPCR-ODM 2.0
(This is considered a 3.0 BC break - the mapping pass was broken in 3.0.0 and 3.0.1 because it tried to call `addDocumentNamespace`)

3.0.1
-----

Expand Down
26 changes: 7 additions & 19 deletions src/DependencyInjection/Compiler/DoctrinePhpcrMappingsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ final class DoctrinePhpcrMappingsPass extends RegisterMappingsPass
* @param string|bool $enabledParameter Service container parameter that must be
* present to enable the mapping. Set to false
* to not do any check, optional.
* @param array $aliasMap map of alias to namespace
*/
public function __construct($driver, array $namespaces, array $managerParameters, $enabledParameter = false, array $aliasMap = [])
public function __construct($driver, array $namespaces, array $managerParameters, $enabledParameter = false)
{
$managerParameters[] = 'doctrine_phpcr.odm.default_document_manager';
parent::__construct(
Expand All @@ -44,8 +43,6 @@ public function __construct($driver, array $namespaces, array $managerParameters
'doctrine_phpcr.odm.%s_metadata_driver',
$enabledParameter,
'doctrine_phpcr.odm.%s_configuration',
'addDocumentNamespace',
$aliasMap
);
}

Expand All @@ -58,19 +55,17 @@ public function __construct($driver, array $namespaces, array $managerParameters
* @param string|bool $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
*/
public static function createXmlMappingDriver(
array $namespaces,
array $managerParameters = [],
$enabledParameter = false,
array $aliasMap = []
): self {
$arguments = [$namespaces, '.phpcr.xml'];
$locator = new Definition(SymfonyFileLocator::class, $arguments);
$driver = new Definition(XmlDriver::class, [$locator]);

return new self($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap);
return new self($driver, $namespaces, $managerParameters, $enabledParameter);
}

/**
Expand All @@ -82,19 +77,17 @@ public static function createXmlMappingDriver(
* @param string|bool $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
*/
public static function createYamlMappingDriver(
array $namespaces,
array $managerParameters = [],
$enabledParameter = false,
array $aliasMap = []
): self {
$arguments = [$namespaces, '.phpcr.yml'];
$locator = new Definition(SymfonyFileLocator::class, $arguments);
$driver = new Definition(YamlDriver::class, [$locator]);

return new self($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap);
return new self($driver, $namespaces, $managerParameters, $enabledParameter);
}

/**
Expand All @@ -106,19 +99,17 @@ public static function createYamlMappingDriver(
* @param string|bool $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
*/
public static function createPhpMappingDriver(
array $mappings,
array $managerParameters = [],
$enabledParameter = false,
array $aliasMap = []
): self {
$arguments = [$mappings, '.php'];
$locator = new Definition(SymfonyFileLocator::class, $arguments);
$driver = new Definition(PHPDriver::class, [$locator]);

return new self($driver, $mappings, $managerParameters, $enabledParameter, $aliasMap);
return new self($driver, $mappings, $managerParameters, $enabledParameter);
}

/**
Expand All @@ -131,16 +122,15 @@ public static function createPhpMappingDriver(
* @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)
public static function createAttributeMappingDriver(array $namespaces, array $directories, array $managerParameters = [], $enabledParameter = false, bool $reportFieldsWhereDeclared = false)
{
$driver = new Definition(AttributeDriver::class, [$directories, $reportFieldsWhereDeclared]);

return new self($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap);
return new self($driver, $namespaces, $managerParameters, $enabledParameter);
}

/**
Expand All @@ -153,17 +143,15 @@ public static function createAttributeMappingDriver(array $namespaces, array $di
* @param string|bool $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
*/
public static function createStaticPhpMappingDriver(
array $namespaces,
array $directories,
array $managerParameters = [],
$enabledParameter = false,
array $aliasMap = []
): self {
$driver = new Definition(StaticPHPDriver::class, [$directories]);

return new self($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap);
return new self($driver, $namespaces, $managerParameters, $enabledParameter);
}
}

0 comments on commit 799c24d

Please sign in to comment.