Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions UPGRADE-2.16.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# UPGRADE FROM 2.15 to 2.16

## Package `doctrine/cache` no longer required

If you use `Doctrine\ODM\MongoDB\Configuration::getMetadataCacheImpl()`,
then you need to require `doctrine/cache` explicitly in `composer.json`;
or use `Doctrine\ODM\MongoDB\Configuration::getMetadataCache()` instead.

6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"require": {
"php": "^8.1",
"ext-mongodb": "^1.21 || ^2.0",
"doctrine/cache": "^1.11 || ^2.0",
"doctrine/collections": "^1.5 || ^2.0",
"doctrine/event-manager": "^1.0 || ^2.0",
"doctrine/instantiator": "^1.1 || ^2",
Expand All @@ -45,6 +44,7 @@
"require-dev": {
"ext-bcmath": "*",
"doctrine/annotations": "^1.12 || ^2.0",
"doctrine/cache": "^2.0",
"doctrine/coding-standard": "^14.0",
"doctrine/orm": "^3.2",
"jmikola/geojson": "^1.0",
Expand All @@ -58,7 +58,9 @@
"symfony/uid": "^5.4 || ^6.0 || ^7.0 || ^8.0"
},
"conflict": {
"doctrine/annotations": "<1.12 || >=3.0"
"doctrine/annotations": "<1.12 || >=3.0",
"doctrine/cache": "<1.11",
"doctrine/mongodb-odm-bundle": "<5"
},
"suggest": {
"doctrine/annotations": "For annotation mapping support",
Expand Down
13 changes: 12 additions & 1 deletion src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,13 @@ public function getMetadataDriverImpl(): ?MappingDriver
return $this->attributes['metadataDriverImpl'] ?? null;
}

/** @deprecated Since 2.2, use {@see getMetadataCache()} instead. */
public function getMetadataCacheImpl(): ?Cache
{
if (! class_exists(DoctrineProvider::class)) {
throw new LogicException('The "doctrine/cache" package is deprecated and no longer required by "doctrine/mongodb-odm". Use "getMetadataCache" instead.');
}

trigger_deprecation(
'doctrine/mongodb-odm',
'2.2',
Expand All @@ -289,6 +294,7 @@ public function getMetadataCacheImpl(): ?Cache
return $this->attributes['metadataCacheImpl'] ?? null;
}

/** @deprecated Since 2.2, use {@see setMetadataCache()} instead. */
public function setMetadataCacheImpl(Cache $cacheImpl): void
{
trigger_deprecation(
Expand All @@ -310,7 +316,12 @@ public function getMetadataCache(): ?CacheItemPoolInterface

public function setMetadataCache(CacheItemPoolInterface $cache): void
{
$this->metadataCache = $cache;
$this->metadataCache = $cache;

if (! class_exists(DoctrineProvider::class)) {
return;
}

$this->attributes['metadataCacheImpl'] = DoctrineProvider::wrap($cache);
}

Expand Down