Skip to content

Commit 1374ca9

Browse files
authored
Merge pull request #410 from doctrine/sf8
allow installation with symfony 8 and test with php 8.5
2 parents 29344d7 + dd3e3ac commit 1374ca9

25 files changed

+366
-423
lines changed

.github/workflows/test-application.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ jobs:
3030
- php-version: "8.3"
3131
symfony-version: "7.*"
3232

33+
- php-version: "8.4"
34+
symfony-version: "8.*"
35+
36+
- php-version: "8.5"
37+
symfony-version: "8.*"
3338
steps:
3439
- name: "Checkout project"
3540
uses: "actions/checkout@v4"

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ Changelog
44
Version 3
55
=========
66

7+
3.1.0
8+
-----
9+
10+
* Support for Symfony 8
11+
* Rewrote service definitions from XML to PHP
12+
* Removed traces of prismic - which could not be installed with DoctrinePHPCRBundle 3 anyway.
13+
* Renamed InitDoctrineDbalCommand and JackrabbitCommand services because they did not match the class name.
14+
(Added an alias with deprecation for BC.)
15+
* Deprecated XmlDriver and YamlDriver in the bundle, as the ones from phpcr-odm are used directly.
16+
717
3.0.3
818
-----
919

composer.json

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
"php": "^8.0",
2525
"ext-dom": "*",
2626
"phpcr/phpcr-utils": "^1.3 || ^2.0",
27-
"symfony/cache": "^5.4 || ^6.0 || ^7.0",
28-
"symfony/doctrine-bridge": "^5.4 || ^6.0 || ^7.0",
29-
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0"
27+
"symfony/cache": "^5.4 || ^6.0 || ^7.0 || ^8.0",
28+
"symfony/doctrine-bridge": "^5.4 || ^6.0 || ^7.0 || ^8.0",
29+
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0 || ^8.0"
3030
},
3131
"conflict": {
3232
"doctrine/doctrine-bundle": "< 2.0.3",
@@ -41,30 +41,31 @@
4141
"require-dev": {
4242
"ext-libxml": "*",
4343
"doctrine/data-fixtures": "^2.0",
44-
"doctrine/doctrine-bundle": "^2.0.3",
44+
"doctrine/doctrine-bundle": "^2.0.3 || ^3.0",
4545
"doctrine/phpcr-odm": "^2.0",
4646
"doctrine/orm": "^2.0 || ^3.0",
4747
"jackalope/jackalope-doctrine-dbal": "^2.0",
48+
"jackalope/jackalope-jackrabbit": "^2.0",
4849
"matthiasnoback/symfony-dependency-injection-test": "^4.3.1 || ^5.0",
4950
"phpcr/phpcr-shell": "^1.6",
5051
"phpstan/phpstan": "^2.0",
5152
"phpstan/phpstan-doctrine": "^2.0",
5253
"phpstan/phpstan-phpunit": "^2.0",
5354
"phpstan/phpstan-symfony": "^2.0",
5455
"phpunit/phpunit": "^9.5",
55-
"symfony/asset": "^5.4 || ^6.0 || ^7.0",
56-
"symfony/browser-kit": "^5.4 || ^6.0 || ^7.0",
57-
"symfony/css-selector": "^5.4 || ^6.0 || ^7.0",
58-
"symfony/error-handler": "^5.4 || ^6.0 || ^7.0",
59-
"symfony/form": "^5.4 || ^6.0 || ^7.0",
60-
"symfony/monolog-bridge": "^5.4 || ^6.0 || ^7.0",
56+
"symfony/asset": "^5.4 || ^6.0 || ^7.0 || ^8.0",
57+
"symfony/browser-kit": "^5.4 || ^6.0 || ^7.0 || ^8.0",
58+
"symfony/css-selector": "^5.4 || ^6.0 || ^7.0 || ^8.0",
59+
"symfony/error-handler": "^5.4 || ^6.0 || ^7.0 || ^8.0",
60+
"symfony/form": "^5.4 || ^6.0 || ^7.0 || ^8.0",
61+
"symfony/monolog-bridge": "^5.4 || ^6.0 || ^7.0 || ^8.0",
6162
"symfony/monolog-bundle": "^3.4",
62-
"symfony/stopwatch": "^5.4 || ^6.0 || ^7.0",
63-
"symfony/templating": "^5.4 || ^6.0 || ^7.0",
64-
"symfony/translation": "^5.4 || ^6.0 || ^7.0",
65-
"symfony/twig-bundle": "^5.4 || ^6.0 || ^7.0",
66-
"symfony/validator": "^5.4 || ^6.0 || ^7.0",
67-
"symfony/web-profiler-bundle": "^5.4 || ^6.0 || ^7.0"
63+
"symfony/stopwatch": "^5.4 || ^6.0 || ^7.0 || ^8.0",
64+
"symfony/templating": "^5.4 || ^6.0 || ^7.0 || ^8.0",
65+
"symfony/translation": "^5.4 || ^6.0 || ^7.0 || ^8.0",
66+
"symfony/twig-bundle": "^5.4 || ^6.0 || ^7.0 || ^8.0",
67+
"symfony/validator": "^5.4 || ^6.0 || ^7.0 || ^8.0",
68+
"symfony/web-profiler-bundle": "^5.4 || ^6.0 || ^7.0 || ^8.0"
6869
},
6970
"suggest": {
7071
"burgov/key-value-form-bundle": "to edit assoc multivalue properties. require version 1.0.*",

src/DependencyInjection/Configuration.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,6 @@ private function getPHPCRSessionsNode(): NodeDefinition
123123
->always()
124124
->then(function ($v) {
125125
switch ($v['type']) {
126-
case 'prismic':
127-
if (!isset($v['url'])) {
128-
throw new InvalidConfigurationException('prismic backend requires the url argument.');
129-
}
130-
131-
break;
132126
case 'jackrabbit':
133127
if (!isset($v['url'])) {
134128
throw new InvalidConfigurationException('jackrabbit backend requires the url argument.');
@@ -145,7 +139,7 @@ private function getPHPCRSessionsNode(): NodeDefinition
145139
->fixXmlConfig('parameter')
146140
->children()
147141
->enumNode('type')
148-
->values(['jackrabbit', 'doctrinedbal', 'prismic'])
142+
->values(['jackrabbit', 'doctrinedbal'])
149143
->defaultValue('jackrabbit')
150144
->end()
151145
// all jackalope

src/DependencyInjection/DoctrinePHPCRExtension.php

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Symfony\Component\DependencyInjection\ContainerBuilder;
2020
use Symfony\Component\DependencyInjection\Definition;
2121
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
22-
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
22+
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
2323
use Symfony\Component\DependencyInjection\Reference;
2424

2525
/**
@@ -35,7 +35,7 @@ final class DoctrinePHPCRExtension extends AbstractDoctrineExtension
3535
*/
3636
private array $sessions = [];
3737

38-
private XmlFileLoader $loader;
38+
private PhpFileLoader $loader;
3939

4040
private bool $disableProxyWarmer = false;
4141

@@ -51,15 +51,15 @@ public function load(array $configs, ContainerBuilder $container): void
5151
$processor = new Processor();
5252
$configuration = new Configuration();
5353
$config = $processor->processConfiguration($configuration, $configs);
54-
$this->loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
54+
$this->loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
5555

56-
$this->loader->load('phpcr.xml');
57-
$this->loader->load('commands.xml');
56+
$this->loader->load('phpcr.php');
57+
$this->loader->load('commands.php');
5858
if (class_exists(BaseJackrabbitCommand::class)) {
59-
$this->loader->load('jackrabbit-commands.xml');
59+
$this->loader->load('jackrabbit-commands.php');
6060
}
6161
if (class_exists(BaseInitDoctrineDbalCommand::class)) {
62-
$this->loader->load('jackalope_doctrine_dbal-commands.xml');
62+
$this->loader->load('jackalope_doctrine_dbal-commands.php');
6363
}
6464

6565
// default values in case no odm is configured. the manager registry needs these variables to be defined.
@@ -126,11 +126,10 @@ private function sessionLoad(array $config, ContainerBuilder $container): void
126126

127127
$type = $session['backend']['type'];
128128
switch ($type) {
129-
case 'prismic':
130129
case 'doctrinedbal':
131130
case 'jackrabbit':
132131
if (empty($loaded['jackalope'])) {
133-
$this->loader->load('jackalope.xml');
132+
$this->loader->load('jackalope.php');
134133
$loaded['jackalope'] = true;
135134
}
136135
$this->loadJackalopeSession($session, $container, $type);
@@ -173,7 +172,7 @@ private function loadJackalopeSession(array $session, ContainerBuilder $containe
173172
;
174173

175174
if (!$this->dbalSchemaListenerLoaded) {
176-
$this->loader->load('jackalope_doctrine_dbal.xml');
175+
$this->loader->load('jackalope_doctrine_dbal.php');
177176
$this->dbalSchemaListenerLoaded = true;
178177
}
179178

@@ -210,10 +209,6 @@ private function loadJackalopeSession(array $session, ContainerBuilder $containe
210209
}
211210
}
212211

213-
break;
214-
case 'prismic':
215-
$backendParameters['jackalope.prismic_uri'] = $session['backend']['url'];
216-
217212
break;
218213
case 'jackrabbit':
219214
$backendParameters['jackalope.jackrabbit_uri'] = $session['backend']['url'];
@@ -352,7 +347,7 @@ private function buildCredentials(ContainerBuilder $container, string $serviceNa
352347

353348
private function loadOdm(array $config, ContainerBuilder $container): void
354349
{
355-
$this->loader->load('odm.xml');
350+
$this->loader->load('odm.php');
356351
$this->loadOdmLocales($config, $container);
357352
$config['document_managers'] = $this->fixManagersAutoMappings($config['document_managers'], $container->getParameter('kernel.bundles'));
358353

@@ -401,7 +396,7 @@ private function loadOdmLocales(array $config, ContainerBuilder $container): voi
401396
}
402397

403398
if (!empty($config['locales'])) {
404-
$this->loader->load('odm_multilang.xml');
399+
$this->loader->load('odm_multilang.php');
405400

406401
foreach ($config['locales'] as $locale => $fallbacks) {
407402
if (\in_array($locale, $fallbacks)) {

src/Mapping/Driver/XmlDriver.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
*
1111
* @author Fabien Potencier <fabien@symfony.com>
1212
* @author Benjamin Eberlei <kontakt@beberlei.de>
13+
*
14+
* @deprecated The mapping pass uses the base class in doctrine/phpcr-odm directly
1315
*/
1416
class XmlDriver extends BaseXmlDriver
1517
{

src/Mapping/Driver/YamlDriver.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
*
1111
* @author Fabien Potencier <fabien@symfony.com>
1212
* @author Benjamin Eberlei <kontakt@beberlei.de>
13+
*
14+
* @deprecated The mapping pass uses the base class in doctrine/phpcr-odm directly
1315
*/
1416
class YamlDriver extends BaseYamlDriver
1517
{

src/Resources/config/commands.php

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
3+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
4+
5+
return static function (ContainerConfigurator $container) {
6+
$services = $container->services();
7+
8+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\WorkspaceQueryCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\WorkspaceQueryCommand::class)
9+
->tag('console.command');
10+
11+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\MigratorMigrateCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\MigratorMigrateCommand::class)
12+
->args([service('service_container')])
13+
->tag('console.command');
14+
15+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\NodeDumpCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\NodeDumpCommand::class)
16+
->args([
17+
service('doctrine_phpcr.console_dumper'),
18+
'%doctrine_phpcr.dump_max_line_length%',
19+
])
20+
->tag('console.command');
21+
22+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\NodeMoveCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\NodeMoveCommand::class)
23+
->tag('console.command');
24+
25+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\NodeRemoveCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\NodeRemoveCommand::class)
26+
->tag('console.command');
27+
28+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\NodesUpdateCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\NodesUpdateCommand::class)
29+
->tag('console.command');
30+
31+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\NodeTouchCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\NodeTouchCommand::class)
32+
->tag('console.command');
33+
34+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\NodeTypeListCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\NodeTypeListCommand::class)
35+
->tag('console.command');
36+
37+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\NodeTypeRegisterCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\NodeTypeRegisterCommand::class)
38+
->tag('console.command');
39+
40+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\PhpcrShellCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\PhpcrShellCommand::class)
41+
->tag('console.command');
42+
43+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\RepositoryInitCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\RepositoryInitCommand::class)
44+
->args([service('doctrine_phpcr.initializer_manager')])
45+
->tag('console.command');
46+
47+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\WorkspaceCreateCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\WorkspaceCreateCommand::class)
48+
->tag('console.command');
49+
50+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\WorkspaceDeleteCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\WorkspaceDeleteCommand::class)
51+
->tag('console.command');
52+
53+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\WorkspaceExportCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\WorkspaceExportCommand::class)
54+
->tag('console.command');
55+
56+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\WorkspaceImportCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\WorkspaceImportCommand::class)
57+
->tag('console.command');
58+
59+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\WorkspaceListCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\WorkspaceListCommand::class)
60+
->tag('console.command');
61+
62+
$services->set(\Doctrine\Bundle\PHPCRBundle\Command\WorkspacePurgeCommand::class, \Doctrine\Bundle\PHPCRBundle\Command\WorkspacePurgeCommand::class)
63+
->tag('console.command');
64+
};

src/Resources/config/commands.xml

Lines changed: 0 additions & 65 deletions
This file was deleted.

src/Resources/config/jackalope.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
4+
5+
return static function (ContainerConfigurator $container) {
6+
$services = $container->services();
7+
8+
$services->set('doctrine_phpcr.jackalope.repository.factory.service.jackrabbit', \Jackalope\RepositoryFactoryJackrabbit::class);
9+
10+
$services->set('doctrine_phpcr.jackalope.repository.factory.jackrabbit', \Jackalope\Repository::class)
11+
->args([[]])
12+
->factory([service('doctrine_phpcr.jackalope.repository.factory.service.jackrabbit'), 'getRepository']);
13+
14+
$services->set('doctrine_phpcr.jackalope.repository.factory.service.doctrinedbal', \Jackalope\RepositoryFactoryDoctrineDBAL::class);
15+
16+
$services->set('doctrine_phpcr.jackalope.repository.factory.doctrinedbal', \Jackalope\Repository::class)
17+
->args([[]])
18+
->factory([service('doctrine_phpcr.jackalope.repository.factory.service.doctrinedbal'), 'getRepository']);
19+
20+
$services->set('doctrine_phpcr.jackalope.session', \Jackalope\Session::class)
21+
->abstract()
22+
->args([
23+
'',
24+
'',
25+
]);
26+
};

0 commit comments

Comments
 (0)