diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml
index 15f49239..fbe756da 100644
--- a/.github/workflows/test-application.yaml
+++ b/.github/workflows/test-application.yaml
@@ -12,20 +12,18 @@ jobs:
test:
name: "PHP ${{ matrix.php-version }}, Symfony ${{ matrix.symfony-version }}"
runs-on: "ubuntu-20.04"
+ env:
+ SYMFONY_REQUIRE: ${{matrix.symfony-require}}
strategy:
fail-fast: false
matrix:
include:
- - php-version: "8.0"
+ - php-version: "8.1"
phpunit-version: "9.5"
phpunit-flags: "-v --coverage-text"
symfony-version: "6.0.*"
- - php-version: "8.0"
- phpunit-version: "9.5"
- symfony-version: "6.0.*"
-
- php-version: "8.1"
phpunit-version: "9.5"
@@ -47,11 +45,13 @@ jobs:
extensions: "pdo, pdo_sqlite"
tools: "composer:v2"
- - name: "Require Specific Symfony Version"
+ - name: "Require specific symfony version"
if: "${{ matrix.symfony-version }}"
- run: "composer require --no-update symfony/symfony:${{ matrix.symfony-version }}"
+ run: |
+ composer require --no-update symfony/flex
+ composer config --no-plugins allow-plugins.symfony/flex true
- - name: "Require Additional dependencies"
+ - name: "Require additional dependencies"
if: "${{ matrix.composer-require }}"
run: "composer require --no-update ${{ matrix.composer-require }}"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fc2f4047..7155e991 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ Changelog
The configuration of metadata_cache_driver changed. By default, it creates an `array` cache.
To configure a service, specify `type: service` and specify your service in the `id` property.
To use a cache pool, specify the service id of that pool.
+* Removed support for namespace alias, use the FQN names.
* Introduced the ManagerRegistryInterface for the ManagerRegistry and adjusted the service alias for autowiring to the interface.
* The following container parameters are no longer taken into account (memcache and apc seem to have never been used anyways).
If you have customised the array cache class, please check if this is still needed - and note that starting from this version,
@@ -27,6 +28,7 @@ Changelog
doctrine_phpcr.odm.cache.memcached_port
doctrine_phpcr.odm.cache.memcached_instance.class
doctrine_phpcr.odm.cache.xcache.class
+
* If no username is defined for a session, and if you use Jackalope >= 2.0, the
credentials service for this session is no longer created and `null` is
passed as credentials.
diff --git a/composer.json b/composer.json
index 3370ef85..68f542c0 100644
--- a/composer.json
+++ b/composer.json
@@ -22,6 +22,7 @@
],
"require": {
"php": "^8.0",
+ "ext-dom": "*",
"phpcr/phpcr-utils": "^1.3 || ^2.0",
"symfony/cache": "^5.4 || ^6.0 || ^7.0",
"symfony/doctrine-bridge": "^5.4 || ^6.0 || ^7.0",
@@ -37,14 +38,14 @@
},
"require-dev": {
"doctrine/doctrine-bundle": "^2.0.3",
- "doctrine/phpcr-odm": "^2.0",
+ "doctrine/phpcr-odm": "2.x-dev",
"doctrine/orm": "^2.0 || ^3.0",
"jackalope/jackalope-doctrine-dbal": "^2.0",
- "matthiasnoback/symfony-dependency-injection-test": "^4.1",
+ "matthiasnoback/symfony-dependency-injection-test": "^4.3.1 || ^5.0",
"symfony/asset": "^5.4 || ^6.0 || ^7.0",
"symfony/browser-kit": "^5.4 || ^6.0 || ^7.0",
"symfony/css-selector": "^5.4 || ^6.0 || ^7.0",
- "symfony/error-handler": "^4.4 || ^5.0 || ^6.0",
+ "symfony/error-handler": "^5.4 || ^6.0 || ^7.0",
"symfony/form": "^5.4 || ^6.0 || ^7.0",
"symfony/monolog-bridge": "^5.4 || ^6.0 || ^7.0",
"symfony/monolog-bundle": "^3.4",
diff --git a/src/CacheWarmer/UniqueNodeTypeCacheWarmer.php b/src/CacheWarmer/UniqueNodeTypeCacheWarmer.php
index fefceba9..965911a8 100644
--- a/src/CacheWarmer/UniqueNodeTypeCacheWarmer.php
+++ b/src/CacheWarmer/UniqueNodeTypeCacheWarmer.php
@@ -29,7 +29,7 @@ public function isOptional(): bool
return true;
}
- public function warmUp($cacheDir): array
+ public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
$helper = new UniqueNodeTypeHelper();
diff --git a/src/Command/LoadFixtureCommand.php b/src/Command/LoadFixtureCommand.php
index 77a7b11d..508389a6 100644
--- a/src/Command/LoadFixtureCommand.php
+++ b/src/Command/LoadFixtureCommand.php
@@ -3,18 +3,17 @@
namespace Doctrine\Bundle\PHPCRBundle\Command;
use Doctrine\Bundle\PHPCRBundle\DataFixtures\PHPCRExecutor;
+use Doctrine\Bundle\PHPCRBundle\Initializer\InitializerManager;
+use Doctrine\Common\DataFixtures\Loader;
use Doctrine\Common\DataFixtures\Purger\PHPCRPurger;
use Doctrine\ODM\PHPCR\Tools\Console\Helper\DocumentManagerHelper;
use InvalidArgumentException;
use PHPCR\Util\Console\Command\BaseCommand;
-use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader;
use Symfony\Bundle\FrameworkBundle\Console\Application;
-use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
-use Symfony\Component\DependencyInjection\ContainerAwareTrait;
/**
* Command to load PHPCR-ODM fixtures.
@@ -26,12 +25,18 @@
*/
class LoadFixtureCommand extends BaseCommand
{
- use ContainerAwareTrait;
+ private const NAME = 'doctrine:phpcr:fixtures:load';
+
+ public function __construct(
+ private InitializerManager $initializerManager
+ ) {
+ parent::__construct(self::NAME);
+ }
protected function configure(): void
{
$this
- ->setName('doctrine:phpcr:fixtures:load')
+ ->setName(self::NAME)
->setDescription('Load data fixtures to your PHPCR database.')
->addOption('fixtures', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'The directory or file to load data fixtures from.')
->addOption('append', null, InputOption::VALUE_NONE, 'Append the data fixtures to the existing data - will not purge the workspace.')
@@ -100,7 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
}
- $loader = new ContainerAwareLoader($this->container);
+ $loader = new Loader();
foreach ($paths as $path) {
if (is_dir($path)) {
$loader->loadFromDirectory($path);
@@ -118,13 +123,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$purger = new PHPCRPurger($dm);
- if ($noInitialize) {
- $initializerManager = null;
- } else {
- $initializerManager = $this->container->get('doctrine_phpcr.initializer_manager');
- }
-
- $executor = new PHPCRExecutor($dm, $purger, $initializerManager);
+ $executor = new PHPCRExecutor($dm, $purger, $noInitialize ? null : $this->initializerManager);
$executor->setLogger(function ($message) use ($output) {
$output->writeln(sprintf(' > %s', $message));
});
diff --git a/src/Command/MigratorMigrateCommand.php b/src/Command/MigratorMigrateCommand.php
index 026d5b21..03b5c18d 100644
--- a/src/Command/MigratorMigrateCommand.php
+++ b/src/Command/MigratorMigrateCommand.php
@@ -9,16 +9,22 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareTrait;
+use Symfony\Component\DependencyInjection\ContainerInterface;
class MigratorMigrateCommand extends BaseCommand
{
- use ContainerAwareTrait;
+ private const NAME = 'doctrine:phpcr:migrator:migrate';
+
+ public function __construct(
+ private ContainerInterface $container
+ ) {
+ parent::__construct(self::NAME);
+ }
protected function configure(): void
{
$this
- ->setName('doctrine:phpcr:migrator:migrate')
+ ->setName(self::NAME)
->setDescription('Migrates PHPCR data.')
->addArgument('migrator_name', InputArgument::OPTIONAL, 'The name of the alias/service to be used to migrate the data.')
->addOption('identifier', null, InputOption::VALUE_REQUIRED, 'Path or UUID of the node to migrate', '/')
diff --git a/src/Command/NodeDumpCommand.php b/src/Command/NodeDumpCommand.php
index d630c204..5f18b89b 100644
--- a/src/Command/NodeDumpCommand.php
+++ b/src/Command/NodeDumpCommand.php
@@ -8,7 +8,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -16,34 +15,15 @@
*
* @author Daniel Barsotti
*/
-class NodeDumpCommand extends BaseDumpCommand implements ContainerAwareInterface
+class NodeDumpCommand extends BaseDumpCommand
{
- private ?ContainerInterface $container = null;
- private PhpcrConsoleDumperHelper $consoleDumper;
+ private const NAME = 'doctrine:phpcr:node:dump';
- protected function getContainer(): ContainerInterface
- {
- if (null === $this->container) {
- $this->container = $this->getApplication()->getKernel()->getContainer();
- }
-
- return $this->container;
- }
-
- public function setContainer(ContainerInterface $container = null): void
- {
- if (!$container) {
- unset($this->container);
-
- return;
- }
-
- $this->container = $container;
- }
-
- public function setConsoleDumper(PhpcrConsoleDumperHelper $consoleDumper): void
- {
- $this->consoleDumper = $consoleDumper;
+ public function __construct(
+ private PhpcrConsoleDumperHelper $consoleDumper,
+ private int $dumpMaxLineLength
+ ) {
+ parent::__construct(self::NAME);
}
protected function configure(): void
@@ -51,7 +31,7 @@ protected function configure(): void
parent::configure();
$this
- ->setName('doctrine:phpcr:node:dump')
+ ->setName(self::NAME)
->addOption('session', null, InputOption::VALUE_REQUIRED, 'The session to use for this command')
;
}
@@ -66,10 +46,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$helperSet = $application->getHelperSet();
$helperSet->set($this->consoleDumper);
- if (!$input->hasOption('max_line_length')
- && $this->getContainer()->hasParameter('doctrine_phpcr.dump_max_line_length')
- ) {
- $input->setOption('max_line_length', $this->getContainer()->getParameter('doctrine_phpcr.dump_max_line_length'));
+ if (!$input->hasOption('max_line_length')) {
+ $input->setOption('max_line_length', $this->dumpMaxLineLength);
}
return parent::execute($input, $output);
diff --git a/src/Command/RepositoryInitCommand.php b/src/Command/RepositoryInitCommand.php
index cc1d6a85..01525090 100644
--- a/src/Command/RepositoryInitCommand.php
+++ b/src/Command/RepositoryInitCommand.php
@@ -2,12 +2,12 @@
namespace Doctrine\Bundle\PHPCRBundle\Command;
+use Doctrine\Bundle\PHPCRBundle\Initializer\InitializerManager;
use Doctrine\ODM\PHPCR\Tools\Console\Command\RegisterSystemNodeTypesCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareTrait;
/**
* Command to collect init operations from any interested bundles.
@@ -16,14 +16,20 @@
*/
class RepositoryInitCommand extends Command
{
- use ContainerAwareTrait;
+ private const NAME = 'doctrine:phpcr:repository:init';
+
+ public function __construct(
+ private InitializerManager $initializerManager
+ ) {
+ parent::__construct(self::NAME);
+ }
protected function configure(): void
{
parent::configure();
$this
- ->setName('doctrine:phpcr:repository:init')
+ ->setName(self::NAME)
->addOption('session', null, InputOption::VALUE_REQUIRED, 'The session to use for this command')
->setDescription('Initialize the PHPCR repository.')
->setHelp(<<<'EOT'
@@ -47,12 +53,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$command->execute($input, $output);
}
- $initializerManager = $this->container->get('doctrine_phpcr.initializer_manager');
- $initializerManager->setLoggingClosure(function ($message) use ($output) {
+ $this->initializerManager->setLoggingClosure(function ($message) use ($output) {
$output->writeln($message);
});
- $initializerManager->initialize($input->getOption('session'));
+ $this->initializerManager->initialize($input->getOption('session'));
return 0;
}
diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php
index 012c68fb..a11da3ef 100644
--- a/src/DependencyInjection/Configuration.php
+++ b/src/DependencyInjection/Configuration.php
@@ -331,7 +331,6 @@ private function getOdmDocumentManagersNode(): NodeDefinition
->scalarNode('mapping')->defaultValue(true)->end()
->scalarNode('type')->end()
->scalarNode('dir')->end()
- ->scalarNode('alias')->end()
->scalarNode('prefix')->end()
->booleanNode('is_bundle')->end()
->end()
diff --git a/src/DependencyInjection/DoctrinePHPCRExtension.php b/src/DependencyInjection/DoctrinePHPCRExtension.php
index 92efaa6f..6d7f5811 100644
--- a/src/DependencyInjection/DoctrinePHPCRExtension.php
+++ b/src/DependencyInjection/DoctrinePHPCRExtension.php
@@ -2,6 +2,8 @@
namespace Doctrine\Bundle\PHPCRBundle\DependencyInjection;
+use Jackalope\Tools\Console\Command\InitDoctrineDbalCommand as BaseInitDoctrineDbalCommand;
+use Jackalope\Tools\Console\Command\JackrabbitCommand as BaseJackrabbitCommand;
use Doctrine\Bundle\PHPCRBundle\ManagerRegistryInterface;
use Doctrine\ODM\PHPCR\Document\Generic;
use Doctrine\ODM\PHPCR\DocumentManagerInterface;
@@ -62,8 +64,14 @@ public function load(array $configs, ContainerBuilder $container)
$this->loader->load('phpcr.xml');
$this->loader->load('commands.xml');
+ if (class_exists(BaseJackrabbitCommand::class)) {
+ $this->loader->load('jackrabbit-commands.xml');
+ }
+ if (class_exists(BaseInitDoctrineDbalCommand::class)) {
+ $this->loader->load('jackalope_doctrine_dbal-commands.xml');
+ }
- // default values in case no odm is configured. the manager registry needs these variables to be defined.
+ // default values in case no odm is configured. the manager registry needs these variables to be defined.
// if odm is enabled, the parameters are overwritten later in the `loadOdm` section.
$container->setParameter('doctrine_phpcr.odm.document_managers', []);
$container->setParameter('doctrine_phpcr.odm.default_document_manager', '');
@@ -500,9 +508,8 @@ private function loadOdmDocumentManager(array $documentManager, ContainerBuilder
private function loadOdmDocumentManagerMappingInformation(array $documentManager, Definition $odmConfig, ContainerBuilder $container): void
{
- // reset state of drivers and alias map. They are only used by this methods and children.
+ // reset state of drivers map. It is only used by this methods and children.
$this->drivers = [];
- $this->aliasMap = [];
if (!class_exists(Generic::class)) {
throw new \RuntimeException('PHPCR ODM is activated in the config but does not seem loadable.');
@@ -519,8 +526,6 @@ private function loadOdmDocumentManagerMappingInformation(array $documentManager
];
$this->loadMappingInformation($documentManager, $container);
$this->registerMappingDrivers($documentManager, $container);
-
- $odmConfig->addMethodCall('setDocumentNamespaces', [$this->aliasMap]);
}
/**
diff --git a/src/DoctrinePHPCRBundle.php b/src/DoctrinePHPCRBundle.php
index 49c70201..6ac9d10d 100644
--- a/src/DoctrinePHPCRBundle.php
+++ b/src/DoctrinePHPCRBundle.php
@@ -5,7 +5,6 @@
use Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\InitializerPass;
use Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\MigratorPass;
use Doctrine\Bundle\PHPCRBundle\OptionalCommand\Jackalope\InitDoctrineDbalCommand;
-use Doctrine\Bundle\PHPCRBundle\OptionalCommand\Jackalope\JackrabbitCommand;
use Doctrine\Bundle\PHPCRBundle\OptionalCommand\ODM\DocumentConvertTranslationCommand;
use Doctrine\Bundle\PHPCRBundle\OptionalCommand\ODM\DocumentMigrateClassCommand;
use Doctrine\Bundle\PHPCRBundle\OptionalCommand\ODM\InfoDoctrineCommand;
@@ -14,7 +13,6 @@
use Doctrine\ODM\PHPCR\Version;
use Jackalope\Session;
use Jackalope\Tools\Console\Command\InitDoctrineDbalCommand as BaseInitDoctrineDbalCommand;
-use Jackalope\Tools\Console\Command\JackrabbitCommand as BaseJackrabbitCommand;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass;
use Symfony\Component\Console\Application;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
@@ -50,9 +48,6 @@ public function registerCommands(Application $application): void
$application->add(new DocumentConvertTranslationCommand());
}
- if (class_exists(BaseJackrabbitCommand::class)) {
- $application->add(new JackrabbitCommand());
- }
if (class_exists(BaseInitDoctrineDbalCommand::class)) {
$application->add(new InitDoctrineDbalCommand());
}
@@ -68,7 +63,7 @@ public function boot(): void
$container = &$this->container;
$this->autoloader = function ($class) use ($namespace, $dir, &$container) {
- if (0 === strpos($class, $namespace)) {
+ if (str_starts_with($class, $namespace)) {
$fileName = str_replace('\\', '', substr($class, \strlen($namespace) + 1));
$file = $dir.\DIRECTORY_SEPARATOR.$fileName.'.php';
diff --git a/src/Form/DataTransformer/DocumentToPathTransformer.php b/src/Form/DataTransformer/DocumentToPathTransformer.php
index 9f16a2cb..28b1fcf6 100644
--- a/src/Form/DataTransformer/DocumentToPathTransformer.php
+++ b/src/Form/DataTransformer/DocumentToPathTransformer.php
@@ -20,7 +20,7 @@ public function __construct(DocumentManagerInterface $dm)
*
* @param object $document
*/
- public function transform($document): ?string
+ public function transform(mixed $document): ?string
{
if (null === $document) {
return null;
@@ -36,7 +36,7 @@ public function transform($document): ?string
*
* @return object|null returns the document or null if $path is empty
*/
- public function reverseTransform($path): ?object
+ public function reverseTransform(mixed $path): ?object
{
if (!$path) {
return null;
diff --git a/src/OptionalCommand/Jackalope/JackrabbitCommand.php b/src/OptionalCommand/Jackalope/JackrabbitCommand.php
index baead9d4..6dd4bcfa 100644
--- a/src/OptionalCommand/Jackalope/JackrabbitCommand.php
+++ b/src/OptionalCommand/Jackalope/JackrabbitCommand.php
@@ -3,53 +3,36 @@
namespace Doctrine\Bundle\PHPCRBundle\OptionalCommand\Jackalope;
use Jackalope\Tools\Console\Command\JackrabbitCommand as BaseJackrabbitCommand;
-use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Wrapper to use this command in the symfony console with multiple sessions.
*
* @author Daniel Barsotti
*/
-class JackrabbitCommand extends BaseJackrabbitCommand implements ContainerAwareInterface
+class JackrabbitCommand extends BaseJackrabbitCommand
{
- private ?ContainerInterface $container = null;
+ private const NAME = 'doctrine:phpcr:jackrabbit';
- protected function getContainer(): ContainerInterface
- {
- if (null === $this->container) {
- $application = $this->getApplication();
- if (!$application instanceof Application) {
- throw new \InvalidArgumentException('Expected to find '.Application::class.' but got '.
- ($application ? \get_class($application) : null));
- }
-
- $this->container = $application->getKernel()->getContainer();
- }
-
- return $this->container;
- }
-
- public function setContainer(ContainerInterface $container = null): void
- {
- $this->container = $container;
+ public function __construct(
+ private string $jackrabbitJar,
+ private string $workspaceDir,
+ ) {
+ parent::__construct(self::NAME);
}
-
protected function configure(): void
{
parent::configure();
$this
- ->setName('doctrine:phpcr:jackrabbit')
+ ->setName(self::NAME)
->setHelp(<<<'EOF'
The doctrine:phpcr:jackrabbit command allows to have a minimal control on the Jackrabbit server from within a
Symfony 2 command.
If the jackrabbit_jar option is set, it will be used as the Jackrabbit server jar file.
-Otherwise you will have to set the doctrine_phpcr.jackrabbit_jar config parameter to a valid Jackrabbit
+Otherwise, you will have to set the doctrine_phpcr.jackrabbit_jar config parameter to a valid Jackrabbit
server jar file.
EOF
)
@@ -58,13 +41,8 @@ protected function configure(): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
- if ($this->getContainer()->hasParameter('doctrine_phpcr.jackrabbit_jar')) {
- $this->setJackrabbitPath($this->getContainer()->getParameter('doctrine_phpcr.jackrabbit_jar'));
- }
-
- if ($this->getContainer()->hasParameter('doctrine_phpcr.workspace_dir')) {
- $this->setWorkspaceDir($this->getContainer()->getParameter('doctrine_phpcr.workspace_dir'));
- }
+ $this->setJackrabbitPath($this->jackrabbitJar);
+ $this->setWorkspaceDir($this->workspaceDir);
return parent::execute($input, $output);
}
diff --git a/src/Resources/config/commands.xml b/src/Resources/config/commands.xml
index 88fb39d6..58cb8ed2 100644
--- a/src/Resources/config/commands.xml
+++ b/src/Resources/config/commands.xml
@@ -6,25 +6,20 @@
-
-
-
+
-
-
-
+
+
+ %doctrine_phpcr.dump_max_line_length%
-
-
-
@@ -48,9 +43,7 @@
-
-
-
+
diff --git a/src/Resources/config/jackalope-doctrine-dbal-commands.xml b/src/Resources/config/jackalope-doctrine-dbal-commands.xml
new file mode 100644
index 00000000..3b55075c
--- /dev/null
+++ b/src/Resources/config/jackalope-doctrine-dbal-commands.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Resources/config/jackrabbit-commands.xml b/src/Resources/config/jackrabbit-commands.xml
new file mode 100644
index 00000000..45a6044f
--- /dev/null
+++ b/src/Resources/config/jackrabbit-commands.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ %doctrine_phpcr.jackrabbit_jar%
+ %doctrine_phpcr.workspace_dir%
+
+
+
+
+
diff --git a/src/Test/RepositoryManager.php b/src/Test/RepositoryManager.php
index eeed9ee3..da3fd4e5 100644
--- a/src/Test/RepositoryManager.php
+++ b/src/Test/RepositoryManager.php
@@ -3,31 +3,30 @@
namespace Doctrine\Bundle\PHPCRBundle\Test;
use Doctrine\Bundle\PHPCRBundle\DataFixtures\PHPCRExecutor;
+use Doctrine\Bundle\PHPCRBundle\Initializer\InitializerManager;
use Doctrine\Bundle\PHPCRBundle\ManagerRegistryInterface;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\DataFixtures\Loader;
use Doctrine\Common\DataFixtures\ProxyReferenceRepository;
use Doctrine\Common\DataFixtures\Purger\PHPCRPurger;
use Doctrine\ODM\PHPCR\DocumentManagerInterface;
-use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader;
-use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* A helper class for tests to reset the repository and load fixtures.
*/
class RepositoryManager
{
- private ContainerInterface $container;
private PHPCRExecutor $executor;
- public function __construct(ContainerInterface $container)
- {
- $this->container = $container;
+ public function __construct(
+ private ManagerRegistryInterface $managerRegistry,
+ private InitializerManager $initializerManager,
+ ) {
}
public function getRegistry(): ManagerRegistryInterface
{
- return $this->container->get('doctrine_phpcr');
+ return $this->managerRegistry;
}
public function getDocumentManager(string $managerName = null): DocumentManagerInterface
@@ -53,7 +52,7 @@ public function purgeRepository(bool $initialize = false): void
*/
public function loadFixtures(array $classNames, bool $initialize = false): void
{
- $loader = new ContainerAwareLoader($this->container);
+ $loader = new Loader();
foreach ($classNames as $className) {
$this->loadFixture($loader, $className);
@@ -101,7 +100,7 @@ private function getExecutor(bool $initialize = false): PHPCRExecutor
return $this->executor;
}
- $initializerManager = $initialize ? $this->container->get('doctrine_phpcr.initializer_manager') : null;
+ $initializerManager = $initialize ? $this->initializerManager : null;
$purger = new PHPCRPurger();
$executor = new PHPCRExecutor($this->getDocumentManager(), $purger, $initializerManager);
$referenceRepository = new ProxyReferenceRepository($this->getDocumentManager());
diff --git a/tests/Fixtures/App/DataFixtures/PHPCR/LoadData.php b/tests/Fixtures/App/DataFixtures/PHPCR/LoadData.php
index 84c22efb..6d30d9dd 100644
--- a/tests/Fixtures/App/DataFixtures/PHPCR/LoadData.php
+++ b/tests/Fixtures/App/DataFixtures/PHPCR/LoadData.php
@@ -20,9 +20,6 @@
class LoadData implements FixtureInterface
{
- /**
- * @param DocumentManager $manager
- */
public function load(ObjectManager $manager): void
{
$base = new Generic();
diff --git a/tests/Fixtures/App/Document/TestDocument.php b/tests/Fixtures/App/Document/TestDocument.php
index e2dee0a4..292f7d84 100644
--- a/tests/Fixtures/App/Document/TestDocument.php
+++ b/tests/Fixtures/App/Document/TestDocument.php
@@ -6,9 +6,6 @@
use Doctrine\Common\Collections\Collection;
use Doctrine\ODM\PHPCR\Mapping\Attributes as PHPCR;
-/**
- * @PHPCR\Document(referenceable=true)
- */
#[PHPCR\Document(referenceable: true)]
class TestDocument
{
diff --git a/tests/Fixtures/App/Kernel.php b/tests/Fixtures/App/Kernel.php
index 41548279..74b2b65e 100644
--- a/tests/Fixtures/App/Kernel.php
+++ b/tests/Fixtures/App/Kernel.php
@@ -32,7 +32,7 @@ public function registerBundles(): iterable
}
}
- public function registerContainerConfiguration(LoaderInterface $loader)
+ public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load(__DIR__.'/config/config.php');
}
diff --git a/tests/Fixtures/fixtures/config/single.php b/tests/Fixtures/fixtures/config/single.php
index 528c890c..4c565712 100644
--- a/tests/Fixtures/fixtures/config/single.php
+++ b/tests/Fixtures/fixtures/config/single.php
@@ -38,7 +38,6 @@
'mapping' => true,
'type' => null,
'dir' => null,
- 'alias' => null,
'prefix' => null,
'is-bundle' => null,
],
diff --git a/tests/Fixtures/fixtures/config/single.xml b/tests/Fixtures/fixtures/config/single.xml
index 6271b319..c1ba2df8 100644
--- a/tests/Fixtures/fixtures/config/single.xml
+++ b/tests/Fixtures/fixtures/config/single.xml
@@ -43,7 +43,6 @@
mapping="true"
type="null"
dir="null"
- alias="null"
prefix="null"
is-bundle="null"
/>
diff --git a/tests/Fixtures/fixtures/config/single.yml b/tests/Fixtures/fixtures/config/single.yml
index fbdf441b..48ef201f 100644
--- a/tests/Fixtures/fixtures/config/single.yml
+++ b/tests/Fixtures/fixtures/config/single.yml
@@ -26,7 +26,6 @@ doctrine_phpcr:
mapping: true
type: ~
dir: ~
- alias: ~
prefix: ~
is_bundle: ~
auto_generate_proxy_classes: true
diff --git a/tests/Functional/BaseTestCase.php b/tests/Functional/BaseTestCase.php
index 0e8b1009..d701f193 100644
--- a/tests/Functional/BaseTestCase.php
+++ b/tests/Functional/BaseTestCase.php
@@ -17,8 +17,9 @@ protected function getRepositoryManager(): RepositoryManager
if (!self::$kernel->getContainer()) {
self::$kernel->boot();
}
+ $container = self::getTestContainer();
- return new RepositoryManager(self::getTestContainer());
+ return new RepositoryManager($container->get('doctrine_phpcr'), $container->get('doctrine_phpcr.initializer_manager'));
}
protected function assertResponseSuccess(Response $response): void
diff --git a/tests/Unit/DependencyInjection/ConfigurationTest.php b/tests/Unit/DependencyInjection/ConfigurationTest.php
index 5e4a1bc4..0c57b435 100644
--- a/tests/Unit/DependencyInjection/ConfigurationTest.php
+++ b/tests/Unit/DependencyInjection/ConfigurationTest.php
@@ -93,7 +93,6 @@ public function configurations(): array
'mapping' => true,
'type' => null,
'dir' => null,
- 'alias' => null,
'prefix' => null,
'is_bundle' => true,
],