Skip to content

Commit 99aa043

Browse files
authored
Deprecate DocumentRepository::clear (#2584)
1 parent b098ab9 commit 99aa043

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/Doctrine/ODM/MongoDB/Repository/DocumentRepository.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use function assert;
2424
use function count;
2525
use function is_array;
26+
use function trigger_deprecation;
2627

2728
/**
2829
* A DocumentRepository serves as a repository for documents with generic as well as
@@ -89,9 +90,18 @@ public function createAggregationBuilder(): AggregationBuilder
8990

9091
/**
9192
* Clears the repository, causing all managed documents to become detached.
93+
*
94+
* @deprecated Deprecated in 2.6, will be removed in 3.0
9295
*/
9396
public function clear(): void
9497
{
98+
trigger_deprecation(
99+
'doctrine/mongodb-odm',
100+
'2.6',
101+
'The %s() method is deprecated and will be removed in Doctrine ODM 3.0.',
102+
__METHOD__,
103+
);
104+
95105
$this->dm->clear($this->class->rootDocumentName);
96106
}
97107

0 commit comments

Comments
 (0)