Skip to content

Commit

Permalink
Deprecate ensureProductionSettings()
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander M. Turek <me@derrabus.de>
  • Loading branch information
derrabus committed Oct 3, 2021
1 parent ebdced6 commit 338dbc4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
Following the deprecation of the method `AbstractHydrator::iterate()`, the
method `hydrateRow()` has been deprecated as well.

## Deprecate cache settings inspection

Doctrine does not provide its own cache implementation anymore and relies on
the PSR-6 standard instead. As a consequence, we cannot determine anymore
whether a given cache adapter is suitable for a production environment.
Because of that, functionality that aims to do so has been deprecated:

* `Configuration::ensureProductionSettings()`
* the `orm:ensure-production-settings` console command

# Upgrade to 2.10

## BC Break: Removed `TABLE` id generator strategy
Expand Down
9 changes: 9 additions & 0 deletions lib/Doctrine/ORM/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@ public function getNamedNativeQuery($name)
* Ensures that this Configuration instance contains settings that are
* suitable for a production environment.
*
* @deprecated
*
* @return void
*
* @throws ProxyClassesAlwaysRegenerating
Expand All @@ -518,6 +520,13 @@ public function getNamedNativeQuery($name)
*/
public function ensureProductionSettings()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/orm',
'TODO',
'%s is deprecated',
__METHOD__
);

$queryCacheImpl = $this->getQueryCacheImpl();

if (! $queryCacheImpl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
/**
* Command to ensure that Doctrine is properly configured for a production environment.
*
* @deprecated
*
* @link www.doctrine-project.org
*/
class EnsureProductionSettingsCommand extends AbstractEntityManagerCommand
Expand All @@ -37,6 +39,7 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
$ui = new SymfonyStyle($input, $output);
$ui->warning('This console command has been deprecated and will be removed in a future version of Doctrine ORM.');

$em = $this->getEntityManager($input);

Expand Down
3 changes: 3 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<referencedClass name="Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper"/>
<!-- The exception is thrown by a deprecated method. -->
<referencedClass name="Doctrine\ORM\Cache\Exception\InvalidResultCacheDriver"/>
<!-- Remove on 3.0.x -->
<referencedClass name="Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand"/>
</errorLevel>
</DeprecatedClass>
<DeprecatedMethod>
Expand All @@ -34,6 +36,7 @@
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getGuidExpression"/>
<!-- Remove on 3.0.x -->
<referencedMethod name="Doctrine\ORM\Internal\Hydration\AbstractHydrator::hydrateRow"/>
<referencedMethod name="Doctrine\ORM\Configuration::ensureProductionSettings"/>
</errorLevel>
</DeprecatedMethod>
<DocblockTypeContradiction>
Expand Down

0 comments on commit 338dbc4

Please sign in to comment.