Skip to content

Commit 4b1a419

Browse files
authored
Remove Configuration::ensureProductionSettings() (#9358)
1 parent 0025878 commit 4b1a419

File tree

11 files changed

+12
-278
lines changed

11 files changed

+12
-278
lines changed

UPGRADE.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Upgrade to 3.0
22

3+
## BC BREAK: Remove cache settings inspection
4+
5+
Doctrine does not provide its own cache implementation anymore and relies on
6+
the PSR-6 standard instead. As a consequence, we cannot determine anymore
7+
whether a given cache adapter is suitable for a production environment.
8+
Because of that, functionality that aims to do so has been removed:
9+
10+
* `Configuration::ensureProductionSettings()`
11+
* the `orm:ensure-production-settings` console command
12+
313
## BC BREAK: PSR-6-based second level cache
414

515
The second level cache has been reworked to consume a PSR-6 cache. Using a
@@ -46,11 +56,6 @@ _before_ upgrading to 3.0:
4656
php doctrine orm:convert-mapping xml /path/to/mapping-path-converted-to-xml
4757
```
4858

49-
## BC BREAK: Remove the `orm:ensure-production-settings` console command
50-
51-
The `orm:ensure-production-settings` console command and its implementation
52-
`Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand` have been removed.
53-
5459
## BC BREAK: Remove code generators and related console commands
5560

5661
These console commands have been removed:

lib/Doctrine/ORM/Cache/Exception/MetadataCacheNotConfigured.php

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

lib/Doctrine/ORM/Cache/Exception/MetadataCacheUsesNonPersistentCache.php

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

lib/Doctrine/ORM/Cache/Exception/QueryCacheNotConfigured.php

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

lib/Doctrine/ORM/Cache/Exception/QueryCacheUsesNonPersistentCache.php

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

lib/Doctrine/ORM/Configuration.php

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,9 @@
1515
use Doctrine\Common\Proxy\AbstractProxyFactory;
1616
use Doctrine\Deprecations\Deprecation;
1717
use Doctrine\ORM\Cache\CacheConfiguration;
18-
use Doctrine\ORM\Cache\Exception\CacheException;
19-
use Doctrine\ORM\Cache\Exception\MetadataCacheNotConfigured;
20-
use Doctrine\ORM\Cache\Exception\MetadataCacheUsesNonPersistentCache;
21-
use Doctrine\ORM\Cache\Exception\QueryCacheNotConfigured;
22-
use Doctrine\ORM\Cache\Exception\QueryCacheUsesNonPersistentCache;
2318
use Doctrine\ORM\Exception\InvalidEntityRepository;
2419
use Doctrine\ORM\Exception\NamedNativeQueryNotFound;
2520
use Doctrine\ORM\Exception\NamedQueryNotFound;
26-
use Doctrine\ORM\Exception\ProxyClassesAlwaysRegenerating;
2721
use Doctrine\ORM\Exception\UnknownEntityNamespace;
2822
use Doctrine\ORM\Internal\Hydration\AbstractHydrator;
2923
use Doctrine\ORM\Mapping\ClassMetadataFactory;
@@ -476,52 +470,6 @@ public function getNamedNativeQuery($name)
476470
return $this->_attributes['namedNativeQueries'][$name];
477471
}
478472

479-
/**
480-
* Ensures that this Configuration instance contains settings that are
481-
* suitable for a production environment.
482-
*
483-
* @deprecated
484-
*
485-
* @return void
486-
*
487-
* @throws ProxyClassesAlwaysRegenerating
488-
* @throws CacheException If a configuration setting has a value that is not
489-
* suitable for a production environment.
490-
*/
491-
public function ensureProductionSettings()
492-
{
493-
Deprecation::triggerIfCalledFromOutside(
494-
'doctrine/orm',
495-
'https://github.com/doctrine/orm/pull/9074',
496-
'%s is deprecated',
497-
__METHOD__
498-
);
499-
500-
$queryCacheImpl = $this->getQueryCacheImpl();
501-
502-
if (! $queryCacheImpl) {
503-
throw QueryCacheNotConfigured::create();
504-
}
505-
506-
if ($queryCacheImpl instanceof ArrayCache) {
507-
throw QueryCacheUsesNonPersistentCache::fromDriver($queryCacheImpl);
508-
}
509-
510-
if ($this->getAutoGenerateProxyClasses()) {
511-
throw ProxyClassesAlwaysRegenerating::create();
512-
}
513-
514-
if (! $this->getMetadataCache()) {
515-
throw MetadataCacheNotConfigured::create();
516-
}
517-
518-
$metadataCacheImpl = $this->getMetadataCacheImpl();
519-
520-
if ($metadataCacheImpl instanceof ArrayCache) {
521-
throw MetadataCacheUsesNonPersistentCache::fromDriver($metadataCacheImpl);
522-
}
523-
}
524-
525473
/**
526474
* Registers a custom DQL function that produces a string value.
527475
* Such a function can then be used in any DQL statement in any place where string

lib/Doctrine/ORM/Exception/ProxyClassesAlwaysRegenerating.php

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

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ parameters:
100100
count: 1
101101
path: lib/Doctrine/ORM/Cache/TimestampQueryCacheValidator.php
102102

103-
-
104-
message: "#^Class Doctrine\\\\Common\\\\Cache\\\\ArrayCache not found\\.$#"
105-
count: 2
106-
path: lib/Doctrine/ORM/Configuration.php
107-
108103
-
109104
message: "#^Parameter \\#2 \\$cache of class Doctrine\\\\Common\\\\Annotations\\\\CachedReader constructor expects Doctrine\\\\Common\\\\Cache\\\\Cache, Doctrine\\\\Common\\\\Cache\\\\ArrayCache given\\.$#"
110105
count: 1

psalm-baseline.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,8 @@
319319
<code>new CachedReader($reader, new ArrayCache())</code>
320320
<code>new SimpleAnnotationReader()</code>
321321
</DeprecatedClass>
322-
<DeprecatedMethod occurrences="4">
322+
<DeprecatedMethod occurrences="1">
323323
<code>AnnotationRegistry::registerFile(__DIR__ . '/Mapping/Driver/DoctrineAnnotations.php')</code>
324-
<code>getAutoGenerateProxyClasses</code>
325-
<code>getMetadataCacheImpl</code>
326-
<code>getQueryCacheImpl</code>
327324
</DeprecatedMethod>
328325
<RedundantCastGivenDocblockType occurrences="1">
329326
<code>(bool) $flag</code>

psalm.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<!-- We're calling the deprecated method for BC here. -->
2929
<file name="lib/Doctrine/ORM/Internal/SQLResultCasing.php"/>
3030
<!-- Remove on 3.0.x -->
31-
<referencedMethod name="Doctrine\ORM\Configuration::ensureProductionSettings"/>
3231
<referencedMethod name="Doctrine\ORM\Id\AbstractIdGenerator::generate"/>
3332
</errorLevel>
3433
</DeprecatedMethod>

0 commit comments

Comments
 (0)