From d15cab5f17cdc0dbf75461011ca6bbfc3739e749 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Fri, 24 Nov 2023 08:38:55 +0100 Subject: [PATCH] Deprecate DocumentRepository::clear --- .../ODM/MongoDB/Repository/DocumentRepository.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/Doctrine/ODM/MongoDB/Repository/DocumentRepository.php b/lib/Doctrine/ODM/MongoDB/Repository/DocumentRepository.php index 3c87639aa8..93cf4e453d 100644 --- a/lib/Doctrine/ODM/MongoDB/Repository/DocumentRepository.php +++ b/lib/Doctrine/ODM/MongoDB/Repository/DocumentRepository.php @@ -23,6 +23,7 @@ use function assert; use function count; use function is_array; +use function trigger_deprecation; /** * A DocumentRepository serves as a repository for documents with generic as well as @@ -89,9 +90,18 @@ public function createAggregationBuilder(): AggregationBuilder /** * Clears the repository, causing all managed documents to become detached. + * + * @deprecated Deprecated in 2.6, will be removed in 3.0 */ public function clear(): void { + trigger_deprecation( + 'doctrine/mongodb-odm', + '2.6', + 'The %s() method is deprecated and will be removed in Doctrine ODM 3.0.', + __METHOD__, + ); + $this->dm->clear($this->class->rootDocumentName); }