Skip to content

Commit

Permalink
Deprecate DocumentRepository::clear (doctrine#2584)
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus authored Nov 24, 2023
1 parent b098ab9 commit 99aa043
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/Doctrine/ODM/MongoDB/Repository/DocumentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 99aa043

Please sign in to comment.