Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5010ebd

Browse filesBrowse files
committed
feature #40908 [Cache] Deprecate DoctrineProvider (derrabus)
This PR was merged into the 5.4 branch. Discussion ---------- [Cache] Deprecate DoctrineProvider | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | N/A | License | MIT | Doc PR | TODO The `DoctrineProvider` class has been reimplemented in the `doctrine/cache` package, so we don't have to maintain it anymore. Commits ------- 16fccfa [Cache] Deprecate DoctrineProvider
2 parents 0e133be + 16fccfa commit 5010ebd
Copy full SHA for 5010ebd

File tree

12 files changed

+41
-24
lines changed
Filter options

12 files changed

+41
-24
lines changed

‎UPGRADE-5.4.md

Copy file name to clipboardExpand all lines: UPGRADE-5.4.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
UPGRADE FROM 5.3 to 5.4
22
=======================
33

4+
Cache
5+
-----
6+
7+
* Deprecate `DoctrineProvider` because this class has been added to the `doctrine/cache` package`
8+
49
FrameworkBundle
510
---------------
611

‎UPGRADE-6.0.md

Copy file name to clipboardExpand all lines: UPGRADE-6.0.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ DoctrineBridge
1111

1212
* Remove `UserLoaderInterface::loadUserByUsername()` in favor of `UserLoaderInterface::loadUserByIdentifier()`
1313

14+
Cache
15+
-----
16+
17+
* Remove `DoctrineProvider` because it has been added to the `doctrine/cache` package
18+
1419
Config
1520
------
1621

‎composer.json

Copy file name to clipboardExpand all lines: composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"cache/integration-tests": "dev-master",
126126
"composer/package-versions-deprecated": "^1.8",
127127
"doctrine/annotations": "^1.12",
128-
"doctrine/cache": "^1.6|^2.0",
128+
"doctrine/cache": "^1.11|^2.0",
129129
"doctrine/collections": "~1.0",
130130
"doctrine/data-fixtures": "^1.1",
131131
"doctrine/dbal": "^2.10|^3.0",

‎src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
use Doctrine\Common\Annotations\CachedReader;
1616
use Doctrine\Common\Annotations\PsrCachedReader;
1717
use Doctrine\Common\Annotations\Reader;
18+
use Doctrine\Common\Cache\Psr6\DoctrineProvider;
1819
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1920
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
20-
use Symfony\Component\Cache\DoctrineProvider;
2121

2222
/**
2323
* Warms up annotation caches for classes found in composer's autoload class map
@@ -56,7 +56,7 @@ protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter)
5656
$annotatedClasses = include $annotatedClassPatterns;
5757
$reader = class_exists(PsrCachedReader::class)
5858
? new PsrCachedReader($this->annotationReader, $arrayAdapter, $this->debug)
59-
: new CachedReader($this->annotationReader, new DoctrineProvider($arrayAdapter), $this->debug)
59+
: new CachedReader($this->annotationReader, DoctrineProvider::wrap($arrayAdapter), $this->debug)
6060
;
6161

6262
foreach ($annotatedClasses as $class) {

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.php
+8-4Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
use Doctrine\Common\Annotations\CachedReader;
1717
use Doctrine\Common\Annotations\PsrCachedReader;
1818
use Doctrine\Common\Annotations\Reader;
19+
use Doctrine\Common\Cache\Psr6\DoctrineProvider;
1920
use Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer;
2021
use Symfony\Component\Cache\Adapter\ArrayAdapter;
2122
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
2223
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
23-
use Symfony\Component\Cache\DoctrineProvider;
2424

2525
return static function (ContainerConfigurator $container) {
2626
$container->services()
@@ -36,9 +36,11 @@
3636
->set('annotations.cached_reader', CachedReader::class)
3737
->args([
3838
service('annotations.reader'),
39-
inline_service(DoctrineProvider::class)->args([
40-
inline_service(ArrayAdapter::class),
41-
]),
39+
inline_service(DoctrineProvider::class)
40+
->factory([DoctrineProvider::class, 'wrap'])
41+
->args([
42+
inline_service(ArrayAdapter::class),
43+
]),
4244
abstract_arg('Debug-Flag'),
4345
])
4446

@@ -50,6 +52,7 @@
5052
])
5153

5254
->set('annotations.filesystem_cache', DoctrineProvider::class)
55+
->factory([DoctrineProvider::class, 'wrap'])
5356
->args([
5457
service('annotations.filesystem_cache_adapter'),
5558
])
@@ -71,6 +74,7 @@
7174
->tag('container.hot_path')
7275

7376
->set('annotations.cache', DoctrineProvider::class)
77+
->factory([DoctrineProvider::class, 'wrap'])
7478
->args([
7579
service('annotations.cache_adapter'),
7680
])

‎src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
use Doctrine\Common\Annotations\CachedReader;
77
use Doctrine\Common\Annotations\PsrCachedReader;
88
use Doctrine\Common\Annotations\Reader;
9+
use Doctrine\Common\Cache\Psr6\DoctrineProvider;
910
use PHPUnit\Framework\MockObject\MockObject;
1011
use Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer;
1112
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1213
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1314
use Symfony\Component\Cache\Adapter\NullAdapter;
1415
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
15-
use Symfony\Component\Cache\DoctrineProvider;
1616
use Symfony\Component\Filesystem\Filesystem;
1717

1818
class AnnotationsCacheWarmerTest extends TestCase
@@ -51,7 +51,7 @@ public function testAnnotationsCacheWarmerWithDebugDisabled()
5151
)
5252
: new CachedReader(
5353
$this->getReadOnlyReader(),
54-
new DoctrineProvider(new PhpArrayAdapter($cacheFile, new NullAdapter()))
54+
DoctrineProvider::wrap(new PhpArrayAdapter($cacheFile, new NullAdapter()))
5555
)
5656
;
5757
$refClass = new \ReflectionClass($this);
@@ -79,7 +79,7 @@ public function testAnnotationsCacheWarmerWithDebugEnabled()
7979
)
8080
: new CachedReader(
8181
$this->getReadOnlyReader(),
82-
new DoctrineProvider($phpArrayAdapter),
82+
DoctrineProvider::wrap($phpArrayAdapter),
8383
true
8484
)
8585
;

‎src/Symfony/Bundle/FrameworkBundle/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/composer.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
"require-dev": {
3636
"doctrine/annotations": "^1.10.4",
37-
"doctrine/cache": "^1.0|^2.0",
37+
"doctrine/cache": "^1.11|^2.0",
3838
"doctrine/persistence": "^1.3|^2.0",
3939
"symfony/asset": "^5.3|^6.0",
4040
"symfony/browser-kit": "^5.4|^6.0",
@@ -70,6 +70,7 @@
7070
"symfony/phpunit-bridge": "^5.3|^6.0"
7171
},
7272
"conflict": {
73+
"doctrine/cache": "<1.11",
7374
"doctrine/persistence": "<1.3",
7475
"phpdocumentor/reflection-docblock": "<3.2.2",
7576
"phpdocumentor/type-resolver": "<1.4.0",

‎src/Symfony/Component/Cache/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
5.4
5+
---
6+
7+
* Deprecate `DoctrineProvider` because this class has been added to the `doctrine/cache` package
8+
49
5.3
510
---
611

‎src/Symfony/Component/Cache/DoctrineProvider.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/DoctrineProvider.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@
1717

1818
/**
1919
* @author Nicolas Grekas <p@tchwork.com>
20+
*
21+
* @deprecated Use Doctrine\Common\Cache\Psr6\DoctrineProvider instead
2022
*/
2123
class DoctrineProvider extends CacheProvider implements PruneableInterface, ResettableInterface
2224
{
2325
private $pool;
2426

2527
public function __construct(CacheItemPoolInterface $pool)
2628
{
29+
trigger_deprecation('symfony/cache', '5.4', '"%s" is deprecated, use "Doctrine\Common\Cache\Psr6\DoctrineProvider" instead.');
30+
2731
$this->pool = $pool;
2832
}
2933

‎src/Symfony/Component/Cache/Tests/DoctrineProviderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/DoctrineProviderTest.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1717
use Symfony\Component\Cache\DoctrineProvider;
1818

19+
/**
20+
* @group legacy
21+
*/
1922
class DoctrineProviderTest extends TestCase
2023
{
2124
public function testProvider()

‎src/Symfony/Component/Validator/ValidatorBuilder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/ValidatorBuilder.php
+1-12Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Doctrine\Common\Cache\Psr6\DoctrineProvider;
2020
use Psr\Cache\CacheItemPoolInterface;
2121
use Symfony\Component\Cache\Adapter\ArrayAdapter;
22-
use Symfony\Component\Cache\DoctrineProvider as SymfonyDoctrineProvider;
2322
use Symfony\Component\Validator\Context\ExecutionContextFactory;
2423
use Symfony\Component\Validator\Exception\LogicException;
2524
use Symfony\Component\Validator\Exception\ValidatorException;
@@ -437,20 +436,10 @@ private function createAnnotationReader(): Reader
437436
}
438437

439438
// Doctrine Annotations < 1.13, Doctrine Cache >= 1.11, Symfony Cache
440-
if (class_exists(CachedReader::class) && class_exists(DoctrineProvider::class) && class_exists(ArrayAdapter::class)) {
439+
if (class_exists(CachedReader::class) && class_exists(ArrayAdapter::class)) {
441440
return new CachedReader(new AnnotationReader(), DoctrineProvider::wrap(new ArrayAdapter()));
442441
}
443442

444-
// Doctrine Annotations < 1.13, Doctrine Cache < 1.11, Symfony Cache
445-
if (class_exists(CachedReader::class) && !class_exists(DoctrineProvider::class) && class_exists(ArrayAdapter::class)) {
446-
return new CachedReader(new AnnotationReader(), new SymfonyDoctrineProvider(new ArrayAdapter()));
447-
}
448-
449-
// Doctrine Annotations < 1.13, Doctrine Cache < 1.11
450-
if (class_exists(CachedReader::class) && class_exists(ArrayCache::class)) {
451-
return new CachedReader(new AnnotationReader(), new ArrayCache());
452-
}
453-
454443
// Doctrine Annotation >= 1.13, Doctrine Cache >= 2, no Symfony Cache
455444
if (class_exists(PsrCachedReader::class)) {
456445
throw new LogicException('Enabling annotation based constraint mapping requires the package symfony/cache to be installed.');

‎src/Symfony/Component/Validator/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/composer.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@
4141
"symfony/property-info": "^5.3|^6.0",
4242
"symfony/translation": "^4.4|^5.0|^6.0",
4343
"doctrine/annotations": "^1.10.4",
44-
"doctrine/cache": "^1.0|^2.0",
44+
"doctrine/cache": "^1.11|^2.0",
4545
"egulias/email-validator": "^2.1.10|^3"
4646
},
4747
"conflict": {
48+
"doctrine/cache": "<1.11",
4849
"doctrine/lexer": "<1.0.2",
4950
"phpunit/phpunit": "<5.4.3",
5051
"symfony/dependency-injection": "<4.4",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.