Skip to content

Commit f190d18

Browse files
authored
Merge pull request #784 from kbond
- Add support Symfony 7 - Remove compatibility before Symfony 6.4
2 parents cfeb317 + 628b820 commit f190d18

File tree

9 files changed

+35
-45
lines changed

9 files changed

+35
-45
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
stability:
2929
- "stable"
3030
symfony-version:
31-
- "5.4.*"
3231
- "6.4.*"
32+
- "7.0.*"
3333
driver-version:
3434
- "stable"
3535
dependencies:
@@ -40,7 +40,10 @@ jobs:
4040
php-version: "8.1"
4141
driver-version: "1.5.0"
4242
stability: "stable"
43-
symfony-version: "5.4.*"
43+
symfony-version: "6.4.*"
44+
exclude:
45+
- php-version: "8.1"
46+
symfony-version: "7.0.*"
4447

4548
services:
4649
mongodb:

DependencyInjection/Compiler/DoctrineMongoDBMappingsPass.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
* Class for Symfony bundles to configure mappings for model classes not in the
1818
* automapped folder.
1919
*
20-
* NOTE: alias is only supported by Symfony 2.6+ and will be ignored with older versions.
21-
*
2220
* @internal since version 4.7.0
2321
*/
2422
final class DoctrineMongoDBMappingsPass extends RegisterMappingsPass

DependencyInjection/DoctrineMongoDBExtension.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Doctrine\Common\EventSubscriber;
2020
use Doctrine\ODM\MongoDB\DocumentManager;
2121
use InvalidArgumentException;
22-
use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver;
2322
use Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension;
2423
use Symfony\Bridge\Doctrine\Messenger\DoctrineClearEntityManagerWorkerSubscriber;
2524
use Symfony\Component\Cache\Adapter\ApcuAdapter;
@@ -400,11 +399,6 @@ private function loadMessengerServices(ContainerBuilder $container): void
400399
/** @param array<string, mixed> $config */
401400
private function loadEntityValueResolverServices(ContainerBuilder $container, FileLoader $loader, array $config): void
402401
{
403-
// available in Symfony 6.2 and higher
404-
if (! class_exists(EntityValueResolver::class)) {
405-
return;
406-
}
407-
408402
$loader->load('value_resolver.xml');
409403

410404
if (! class_exists(ExpressionLanguage::class)) {

Form/DoctrineMongoDBExtension.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ public function __construct(ManagerRegistry $registry)
2323
}
2424

2525
/** @return FormTypeInterface[] */
26-
protected function loadTypes()
26+
protected function loadTypes(): array
2727
{
2828
return [
2929
new Type\DocumentType($this->registry),
3030
];
3131
}
3232

33-
/** @return FormTypeGuesserInterface|null */
34-
protected function loadTypeGuesser()
33+
protected function loadTypeGuesser(): ?FormTypeGuesserInterface
3534
{
3635
return new DoctrineMongoDBTypeGuesser($this->registry);
3736
}

Form/DoctrineMongoDBTypeGuesser.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public function __construct(ManagerRegistry $registry)
3838
$this->registry = $registry;
3939
}
4040

41-
/** @return TypeGuess|null */
42-
public function guessType(string $class, string $property)
41+
public function guessType(string $class, string $property): ?TypeGuess
4342
{
4443
$ret = $this->getMetadata($class);
4544
if (! $ret) {
@@ -114,10 +113,11 @@ public function guessType(string $class, string $property)
114113
Guess::MEDIUM_CONFIDENCE,
115114
);
116115
}
116+
117+
return null;
117118
}
118119

119-
/** @return ValueGuess|null */
120-
public function guessRequired(string $class, string $property)
120+
public function guessRequired(string $class, string $property): ?ValueGuess
121121
{
122122
$ret = $this->getMetadata($class);
123123
if ($ret && $ret[0]->hasField($property)) {
@@ -137,8 +137,7 @@ public function guessRequired(string $class, string $property)
137137
return null;
138138
}
139139

140-
/** @return ValueGuess|null */
141-
public function guessMaxLength(string $class, string $property)
140+
public function guessMaxLength(string $class, string $property): ?ValueGuess
142141
{
143142
return null;
144143
}
@@ -150,8 +149,7 @@ public function guessMinLength($class, $property): void
150149
{
151150
}
152151

153-
/** @return ValueGuess|null */
154-
public function guessPattern(string $class, string $property)
152+
public function guessPattern(string $class, string $property): ?ValueGuess
155153
{
156154
$ret = $this->getMetadata($class);
157155
if (! $ret || ! $ret[0]->hasField($property) || $ret[0]->hasAssociation($property)) {

README.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Compatibility
1515
The current version of this bundle has the following requirements:
1616
* PHP 8.1 or newer is required
1717
* `ext-mongodb` 1.5 or newer
18-
* Symfony 5.4 or newer is required
18+
* Symfony 6.4 or newer is required
1919

20-
Support for older Symfony, PHP and MongoDB versions is provided via the `3.0.x`
21-
releases (tracked in the `3.0` branch). This version sees bug and security fixes
20+
Support for older Symfony, PHP and MongoDB versions is provided via the `4.7.x`
21+
releases (tracked in the `4.7.x` branch). This version sees bug and security fixes
2222
only.

Tests/Validator/Constraints/UniqueTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,25 @@
77
use Doctrine\Bundle\MongoDBBundle\Validator\Constraints\Unique;
88
use PHPUnit\Framework\TestCase;
99
use Symfony\Component\Validator\Mapping\ClassMetadata;
10-
use Symfony\Component\Validator\Mapping\Loader\AnnotationLoader;
11-
12-
use function assert;
10+
use Symfony\Component\Validator\Mapping\Loader\AttributeLoader;
1311

1412
final class UniqueTest extends TestCase
1513
{
1614
public function testWithDefaultProperty(): void
1715
{
1816
$metadata = new ClassMetadata(UniqueDocumentDummyOne::class);
1917

20-
$loader = new AnnotationLoader();
18+
$loader = new AttributeLoader();
2119

2220
self::assertTrue($loader->loadClassMetadata($metadata));
2321

2422
[$constraint] = $metadata->getConstraints();
25-
assert($constraint instanceof Unique);
23+
self::assertInstanceOf(Unique::class, $constraint);
2624
self::assertSame(['email'], $constraint->fields);
2725
self::assertSame('doctrine_odm.mongodb.unique', $constraint->validatedBy());
2826
}
2927
}
3028

31-
/** @Unique(fields={"email"}) */
3229
#[Unique(['email'])]
3330
class UniqueDocumentDummyOne
3431
{

UPGRADE-5.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
UPGRADE FROM 4.x to 5.0
22
=======================
33

4+
* Add support for Symfony 7.0 and require at least Symfony 6.4
45
* The `doctrine:mongodb:tail-cursor` command and
56
`Doctrine\Bundle\MongoDBBundle\Cursor\TailableCursorProcessorInterface`
67
interface have been dropped. You should use

composer.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,27 @@
3030
"doctrine/mongodb-odm": "^2.3",
3131
"doctrine/persistence": "^2.2 || ^3.0",
3232
"psr/log": "^1.0 || ^2.0 || ^3.0",
33-
"symfony/config": "^5.4 || ^6.2",
34-
"symfony/console": "^5.4 || ^6.2",
35-
"symfony/dependency-injection": "^5.4 || ^6.2",
33+
"symfony/config": "^6.4 || ^7.0",
34+
"symfony/console": "^6.4 || ^7.0",
35+
"symfony/dependency-injection": "^6.4 || ^7.0",
3636
"symfony/deprecation-contracts": "^2.1 || ^3.0",
37-
"symfony/doctrine-bridge": "^5.4.19 || ^6.2",
38-
"symfony/framework-bundle": "^5.4 || ^6.2",
39-
"symfony/http-kernel": "^5.4 || ^6.2",
40-
"symfony/options-resolver": "^5.4 || ^6.2"
37+
"symfony/doctrine-bridge": "^6.4 || ^7.0",
38+
"symfony/framework-bundle": "^6.4 || ^7.0",
39+
"symfony/http-kernel": "^6.4 || ^7.0",
40+
"symfony/options-resolver": "^6.4 || ^7.0"
4141
},
4242
"require-dev": {
4343
"doctrine/coding-standard": "^11.0",
44-
"doctrine/data-fixtures": "^1.3",
44+
"doctrine/data-fixtures": "^1.7",
4545
"phpunit/phpunit": "^9.5.5",
4646
"psalm/plugin-symfony": "^5.0",
47-
"symfony/browser-kit": "^5.4 || ^6.2",
48-
"symfony/form": "^5.4 || ^6.2",
49-
"symfony/phpunit-bridge": "^6.2",
50-
"symfony/security-bundle": "^5.4 || ^6.2",
51-
"symfony/stopwatch": "^5.4 || ^6.2",
52-
"symfony/validator": "^5.4 || ^6.2",
53-
"symfony/yaml": "^5.4 || ^6.2",
47+
"symfony/browser-kit": "^6.4 || ^7.0",
48+
"symfony/form": "^6.4 || ^7.0",
49+
"symfony/phpunit-bridge": "^6.4.1 || ^7.0.1",
50+
"symfony/security-bundle": "^6.4 || ^7.0",
51+
"symfony/stopwatch": "^6.4 || ^7.0",
52+
"symfony/validator": "^6.4 || ^7.0",
53+
"symfony/yaml": "^6.4 || ^7.0",
5454
"vimeo/psalm": "^5.12"
5555
},
5656
"conflict": {

0 commit comments

Comments
 (0)