doctrine/mongodb-odm

Deprecation notice when calling DocumentRepository->clear() since 2.4.0

TranquilCapybara16493 opened this issue · 2 comments

Q A
Version 2.4.0+

Support Question

Since in 2.4.0 deprecation notices were introduced in b261884

Following deprecation notice is triggered
PHP Deprecated: Since doctrine/mongodb-odm 2.4: Calling Doctrine\ODM\MongoDB\DocumentManager::clear() with any arguments to clear specific documents is deprecated and will not be supported in Doctrine ODM 3.0. in /var/www/project/vendor/symfony/deprecation-contracts/function.php on line 25

whenever DocumentRepository->clear() method is called because it passes an argument to DocumentManager

public function clear(): void
{
$this->dm->clear($this->class->rootDocumentName);
}

public function clear($objectName = null)
{
if ($objectName !== null) {
trigger_deprecation(
'doctrine/mongodb-odm',
'2.4',
'Calling %s() with any arguments to clear specific documents is deprecated and will not be supported in Doctrine ODM 3.0.',
__METHOD__
);
}
$this->unitOfWork->clear($objectName);

Is there any intent to either deprecate DocumentRepository->clear() or what should be a proper course of action in this case?

Is there any intent to either deprecate DocumentRepository->clear() or what should be a proper course of action in this case?

Yes, DocumentRepository::clear should have been deprecated in 2.4 along with the original deprecation, not doing so was our bad. We'll add the deprecation in 2.5.x :)

I've opened #2584 to deprecate this in 2.6.0, as required by Semver.