From bb21865cba0475d74ada1f487e4c2fef59256ee4 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Tue, 4 Jul 2023 14:22:10 +0200 Subject: [PATCH] Deprecate classes related to old commit order computation --- UPGRADE.md | 7 +++++++ lib/Doctrine/ORM/Internal/CommitOrder/Edge.php | 9 +++++++++ lib/Doctrine/ORM/Internal/CommitOrder/Vertex.php | 8 ++++++++ lib/Doctrine/ORM/Internal/CommitOrder/VertexState.php | 8 ++++++++ lib/Doctrine/ORM/Internal/CommitOrderCalculator.php | 11 +++++++++++ 5 files changed, 43 insertions(+) diff --git a/UPGRADE.md b/UPGRADE.md index bf2d9b385db..ef703efa09d 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,12 @@ # Upgrade to 2.16 +## Deprecated `\Doctrine\ORM\Internal\CommitOrderCalculator` and related classes + +With changes made to the commit order computation, the internal classes +`\Doctrine\ORM\Internal\CommitOrderCalculator`, `\Doctrine\ORM\Internal\CommitOrder\Edge`, +`\Doctrine\ORM\Internal\CommitOrder\Vertex` and `\Doctrine\ORM\Internal\CommitOrder\VertexState` +have been deprecated and will be removed in ORM 3.0. + ## Deprecated returning post insert IDs from `EntityPersister::executeInserts()` Persisters implementing `\Doctrine\ORM\Persisters\Entity\EntityPersister` should no longer diff --git a/lib/Doctrine/ORM/Internal/CommitOrder/Edge.php b/lib/Doctrine/ORM/Internal/CommitOrder/Edge.php index f1457755ee1..dc840c93843 100644 --- a/lib/Doctrine/ORM/Internal/CommitOrder/Edge.php +++ b/lib/Doctrine/ORM/Internal/CommitOrder/Edge.php @@ -4,6 +4,8 @@ namespace Doctrine\ORM\Internal\CommitOrder; +use Doctrine\Deprecations\Deprecation; + /** @internal */ final class Edge { @@ -27,6 +29,13 @@ final class Edge public function __construct(string $from, string $to, int $weight) { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/orm', + 'https://github.com/doctrine/orm/pull/10547', + 'The %s class is deprecated and will be removed in ORM 3.0', + self::class + ); + $this->from = $from; $this->to = $to; $this->weight = $weight; diff --git a/lib/Doctrine/ORM/Internal/CommitOrder/Vertex.php b/lib/Doctrine/ORM/Internal/CommitOrder/Vertex.php index c4747e032d1..969a75b851a 100644 --- a/lib/Doctrine/ORM/Internal/CommitOrder/Vertex.php +++ b/lib/Doctrine/ORM/Internal/CommitOrder/Vertex.php @@ -4,6 +4,7 @@ namespace Doctrine\ORM\Internal\CommitOrder; +use Doctrine\Deprecations\Deprecation; use Doctrine\ORM\Mapping\ClassMetadata; /** @internal */ @@ -32,6 +33,13 @@ final class Vertex public function __construct(string $hash, ClassMetadata $value) { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/orm', + 'https://github.com/doctrine/orm/pull/10547', + 'The %s class is deprecated and will be removed in ORM 3.0', + self::class + ); + $this->hash = $hash; $this->value = $value; } diff --git a/lib/Doctrine/ORM/Internal/CommitOrder/VertexState.php b/lib/Doctrine/ORM/Internal/CommitOrder/VertexState.php index 395db58d554..9ace165d20d 100644 --- a/lib/Doctrine/ORM/Internal/CommitOrder/VertexState.php +++ b/lib/Doctrine/ORM/Internal/CommitOrder/VertexState.php @@ -4,6 +4,8 @@ namespace Doctrine\ORM\Internal\CommitOrder; +use Doctrine\Deprecations\Deprecation; + /** @internal */ final class VertexState { @@ -13,5 +15,11 @@ final class VertexState private function __construct() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/orm', + 'https://github.com/doctrine/orm/pull/10547', + 'The %s class is deprecated and will be removed in ORM 3.0', + self::class + ); } } diff --git a/lib/Doctrine/ORM/Internal/CommitOrderCalculator.php b/lib/Doctrine/ORM/Internal/CommitOrderCalculator.php index 22ee1ab13bd..d45e65c40b5 100644 --- a/lib/Doctrine/ORM/Internal/CommitOrderCalculator.php +++ b/lib/Doctrine/ORM/Internal/CommitOrderCalculator.php @@ -4,6 +4,7 @@ namespace Doctrine\ORM\Internal; +use Doctrine\Deprecations\Deprecation; use Doctrine\ORM\Internal\CommitOrder\Edge; use Doctrine\ORM\Internal\CommitOrder\Vertex; use Doctrine\ORM\Internal\CommitOrder\VertexState; @@ -45,6 +46,16 @@ class CommitOrderCalculator */ private $sortedNodeList = []; + public function __construct() + { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/orm', + 'https://github.com/doctrine/orm/pull/10547', + 'The %s class is deprecated and will be removed in ORM 3.0', + self::class + ); + } + /** * Checks for node (vertex) existence in graph. *