Skip to content

Commit b31e7d0

Browse files
authored
Merge pull request #2062 from doctrine/2.16.x
Merge 2.16.x up into 2.17.x
2 parents 6080017 + 6262991 commit b31e7d0

File tree

11 files changed

+69
-81
lines changed

11 files changed

+69
-81
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
"require": {
3232
"php": "^8.1",
3333
"doctrine/dbal": "^3.7.0 || ^4.0",
34+
"doctrine/deprecations": "^1.0",
3435
"doctrine/persistence": "^3.1 || ^4",
3536
"doctrine/sql-formatter": "^1.0.1",
3637
"symfony/cache": "^6.4 || ^7.0",
3738
"symfony/config": "^6.4 || ^7.0",
3839
"symfony/console": "^6.4 || ^7.0",
3940
"symfony/dependency-injection": "^6.4 || ^7.0",
40-
"symfony/deprecation-contracts": "^2.1 || ^3",
4141
"symfony/doctrine-bridge": "^6.4.3 || ^7.0.3",
4242
"symfony/framework-bundle": "^6.4 || ^7.0",
4343
"symfony/service-contracts": "^2.5 || ^3"
@@ -46,7 +46,6 @@
4646
"doctrine/annotations": "^1 || ^2",
4747
"doctrine/cache": "^1.11 || ^2.0",
4848
"doctrine/coding-standard": "^13",
49-
"doctrine/deprecations": "^1.0",
5049
"doctrine/orm": "^2.17 || ^3.1",
5150
"friendsofphp/proxy-manager-lts": "^1.0",
5251
"phpstan/phpstan": "2.1.1",

src/Command/Proxy/DoctrineCommandHelper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
66

7+
use Doctrine\Deprecations\Deprecation;
78
use Doctrine\ORM\EntityManagerInterface;
89
use Doctrine\ORM\Tools\Console\EntityManagerProvider;
910
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
1011
use Symfony\Bundle\FrameworkBundle\Console\Application;
1112

1213
use function assert;
13-
use function trigger_deprecation;
1414

1515
/**
1616
* Provides some helper and convenience methods to configure doctrine commands in the context of bundles
@@ -33,9 +33,9 @@ public static function setApplicationEntityManager(Application $application, $em
3333
/* @phpstan-ignore class.notFound, argument.type (ORM < 3 specific) */
3434
$helperSet->set(new EntityManagerHelper($em), 'em');
3535

36-
trigger_deprecation(
36+
Deprecation::trigger(
3737
'doctrine/doctrine-bundle',
38-
'2.7',
38+
'https://github.com/doctrine/DoctrineBundle/pull/1513',
3939
'Providing an EntityManager using "%s" is deprecated. Use an instance of "%s" instead.',
4040
/* @phpstan-ignore class.notFound */
4141
EntityManagerHelper::class,

src/Command/Proxy/OrmProxyCommand.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44

55
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
66

7+
use Doctrine\Deprecations\Deprecation;
78
use Doctrine\ORM\Tools\Console\EntityManagerProvider;
89
use Symfony\Component\Console\Input\InputInterface;
910
use Symfony\Component\Console\Output\OutputInterface;
1011

11-
use function trigger_deprecation;
12-
1312
/**
1413
* @internal
1514
* @deprecated
@@ -21,9 +20,9 @@ public function __construct(
2120
) {
2221
parent::__construct($entityManagerProvider);
2322

24-
trigger_deprecation(
23+
Deprecation::trigger(
2524
'doctrine/doctrine-bundle',
26-
'2.8',
25+
'https://github.com/doctrine/DoctrineBundle/pull/1581',
2726
'Class "%s" is deprecated. Use "%s" instead.',
2827
self::class,
2928
parent::class,

src/Command/Proxy/RunSqlDoctrineCommand.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
66

77
use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand;
8+
use Doctrine\Deprecations\Deprecation;
89
use Symfony\Component\Console\Input\InputInterface;
910
use Symfony\Component\Console\Output\OutputInterface;
1011

11-
use function trigger_deprecation;
12-
1312
/**
1413
* Execute a SQL query and output the results.
1514
*
@@ -33,9 +32,9 @@ protected function configure(): void
3332

3433
protected function execute(InputInterface $input, OutputInterface $output): int
3534
{
36-
trigger_deprecation(
35+
Deprecation::trigger(
3736
'doctrine/doctrine-bundle',
38-
'2.2',
37+
'https://github.com/doctrine/DoctrineBundle/pull/1231',
3938
'The "%s" (doctrine:query:sql) is deprecated, use dbal:run-sql command instead.',
4039
self::class,
4140
);

src/ConnectionFactory.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
use function is_array;
2929
use function is_subclass_of;
3030
use function method_exists;
31-
use function trigger_deprecation;
3231

3332
use const PHP_EOL;
3433

@@ -117,7 +116,11 @@ public function createConnection(
117116
$overriddenOptions = [];
118117
/** @phpstan-ignore isset.offset (We should adjust when https://github.com/phpstan/phpstan/issues/12414 is fixed) */
119118
if (isset($params['connection_override_options'])) {
120-
trigger_deprecation('doctrine/doctrine-bundle', '2.4', 'The "connection_override_options" connection parameter is deprecated');
119+
Deprecation::trigger(
120+
'doctrine/doctrine-bundle',
121+
'https://github.com/doctrine/DoctrineBundle/pull/1342',
122+
'The "connection_override_options" connection parameter is deprecated',
123+
);
121124
$overriddenOptions = $params['connection_override_options'];
122125
unset($params['connection_override_options']);
123126
}

src/DependencyInjection/Compiler/CacheSchemaSubscriberPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Symfony\Component\DependencyInjection\Reference;
1111

1212
/**
13-
* Injects Doctrine DBAL and legacy PDO adapters into their schema subscribers.
13+
* Injects Doctrine DBAL adapters into their schema subscriber.
1414
*
1515
* Must be run later after ResolveChildDefinitionsPass.
1616
*

src/DependencyInjection/Configuration.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
use function strpos;
4545
use function strtoupper;
4646
use function substr;
47-
use function trigger_deprecation;
4847

4948
/**
5049
* This class contains the configuration information for the bundle
@@ -309,9 +308,9 @@ private function configureDbalDriverNode(ArrayNodeDefinition $node): void
309308

310309
if ($urlConflictingValues) {
311310
$tail = count($urlConflictingValues) > 1 ? sprintf('or "%s" options', array_pop($urlConflictingValues)) : 'option';
312-
trigger_deprecation(
311+
Deprecation::trigger(
313312
'doctrine/doctrine-bundle',
314-
'2.4',
313+
'https://github.com/doctrine/DoctrineBundle/pull/1342',
315314
'Setting the "doctrine.dbal.%s" %s while the "url" one is defined is deprecated',
316315
implode('", "', $urlConflictingValues),
317316
$tail,

src/DependencyInjection/DoctrineExtension.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection;
2121
use Doctrine\DBAL\Driver\Middleware as MiddlewareInterface;
2222
use Doctrine\DBAL\Schema\LegacySchemaManagerFactory;
23+
use Doctrine\Deprecations\Deprecation;
2324
use Doctrine\ORM\Configuration as ORMConfiguration;
2425
use Doctrine\ORM\EntityManagerInterface;
2526
use Doctrine\ORM\Events;
@@ -83,7 +84,6 @@
8384
use function reset;
8485
use function sprintf;
8586
use function str_replace;
86-
use function trigger_deprecation;
8787

8888
use const PHP_VERSION_ID;
8989

@@ -507,12 +507,20 @@ protected function ormLoad(array $config, ContainerBuilder $container)
507507
}
508508

509509
if ($config['controller_resolver']['auto_mapping'] === null) {
510-
trigger_deprecation('doctrine/doctrine-bundle', '2.12', 'The default value of "doctrine.orm.controller_resolver.auto_mapping" will be changed from `true` to `false`. Explicitly configure `true` to keep existing behaviour.');
510+
Deprecation::trigger(
511+
'doctrine/doctrine-bundle',
512+
'https://github.com/doctrine/DoctrineBundle/pull/1762',
513+
'The default value of "doctrine.orm.controller_resolver.auto_mapping" will be changed from `true` to `false`. Explicitly configure `true` to keep existing behaviour.',
514+
);
511515
$config['controller_resolver']['auto_mapping'] = true;
512516
}
513517

514518
if ($config['controller_resolver']['auto_mapping'] === true) {
515-
trigger_deprecation('doctrine/doctrine-bundle', '2.13', 'Enabling the controller resolver automapping feature has been deprecated. Symfony Mapped Route Parameters should be used as replacement.');
519+
Deprecation::trigger(
520+
'doctrine/doctrine-bundle',
521+
'https://github.com/doctrine/DoctrineBundle/pull/1804',
522+
'Enabling the controller resolver automapping feature has been deprecated. Symfony Mapped Route Parameters should be used as replacement.',
523+
);
516524
}
517525

518526
if (! $config['controller_resolver']['auto_mapping']) {
@@ -578,7 +586,11 @@ protected function ormLoad(array $config, ContainerBuilder $container)
578586
'Lazy ghost objects cannot be disabled for ORM 3.',
579587
);
580588
} else {
581-
trigger_deprecation('doctrine/doctrine-bundle', '2.11', 'Not setting "doctrine.orm.enable_lazy_ghost_objects" to true is deprecated.');
589+
Deprecation::trigger(
590+
'doctrine/doctrine-bundle',
591+
'https://github.com/doctrine/DoctrineBundle/pull/1568',
592+
'Not setting "doctrine.orm.enable_lazy_ghost_objects" to true is deprecated.',
593+
);
582594
}
583595

584596
if ($config['enable_native_lazy_objects'] ?? false) {
@@ -596,7 +608,11 @@ protected function ormLoad(array $config, ContainerBuilder $container)
596608
$container->removeDefinition('doctrine.orm.proxy_cache_warmer');
597609
} elseif (! class_exists(AnnotationDriver::class) && PHP_VERSION_ID >= 80400) {
598610
// Only emit the deprecation notice for ORM 3 and PHP 8.4+ users
599-
trigger_deprecation('doctrine/doctrine-bundle', '2.16', 'Not setting "doctrine.orm.enable_native_lazy_objects" to true is deprecated.');
611+
Deprecation::trigger(
612+
'doctrine/doctrine-bundle',
613+
'https://github.com/doctrine/DoctrineBundle/pull/1905',
614+
'Not setting "doctrine.orm.enable_native_lazy_objects" to true is deprecated.',
615+
);
600616
}
601617

602618
$options = ['auto_generate_proxy_classes', 'enable_lazy_ghost_objects', 'enable_native_lazy_objects', 'proxy_dir', 'proxy_namespace'];

src/Repository/ContainerRepositoryFactory.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Doctrine\Bundle\DoctrineBundle\Repository;
66

77
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\ServiceRepositoryCompilerPass;
8+
use Doctrine\Deprecations\Deprecation;
89
use Doctrine\ORM\EntityManagerInterface;
910
use Doctrine\ORM\EntityRepository;
1011
use Doctrine\ORM\Mapping\ClassMetadata;
@@ -18,7 +19,6 @@
1819
use function is_a;
1920
use function spl_object_hash;
2021
use function sprintf;
21-
use function trigger_deprecation;
2222

2323
/**
2424
* Fetches repositories from the container or falls back to normal creation.
@@ -64,7 +64,14 @@ private function doGetRepository(EntityManagerInterface $entityManager, string $
6464
}
6565

6666
if (! $repository instanceof EntityRepository) {
67-
trigger_deprecation('doctrine/doctrine-bundle', '2.11', 'The service "%s" of type "%s" should extend "%s", not doing so is deprecated.', $repositoryServiceId, get_debug_type($repository), EntityRepository::class);
67+
Deprecation::trigger(
68+
'doctrine/doctrine-bundle',
69+
'https://github.com/doctrine/DoctrineBundle/pull/1722',
70+
'The service "%s" of type "%s" should extend "%s", not doing so is deprecated.',
71+
$repositoryServiceId,
72+
get_debug_type($repository),
73+
EntityRepository::class,
74+
);
6875
}
6976

7077
/** @phpstan-var ObjectRepository<T> */

src/Twig/DoctrineExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Doctrine\Bundle\DoctrineBundle\Twig;
66

7+
use Doctrine\Deprecations\Deprecation;
78
use Doctrine\SqlFormatter\HtmlHighlighter;
89
use Doctrine\SqlFormatter\NullHighlighter;
910
use Doctrine\SqlFormatter\SqlFormatter;
@@ -27,7 +28,6 @@
2728
use function sprintf;
2829
use function strtoupper;
2930
use function substr;
30-
use function trigger_deprecation;
3131

3232
/**
3333
* This class contains the needed functions in order to do the query highlighting
@@ -156,9 +156,9 @@ static function ($matches) use ($parameters, &$i) {
156156
*/
157157
public function formatQuery($sql, $highlightOnly = false)
158158
{
159-
trigger_deprecation(
159+
Deprecation::trigger(
160160
'doctrine/doctrine-bundle',
161-
'2.1',
161+
'https://github.com/doctrine/DoctrineBundle/pull/1056',
162162
'The "%s()" method is deprecated and will be removed in doctrine-bundle 3.0.',
163163
__METHOD__,
164164
);

0 commit comments

Comments
 (0)