Calling Doctrine\ORM\EntityManager::clear() with any arguments to clear specific entities is deprecated #6352

Open
opened 2026-01-22 15:31:35 +01:00 by admin · 0 comments
Owner

Originally created by @ruudk on GitHub (Nov 26, 2019).

Originally assigned to: @lcobucci on GitHub.

Bug Report

Q A
BC Break no
Version 2.7.0

Summary

Calling Doctrine\ORM\EntityRepository::clear triggers deprecation message:

User Deprecated: Calling Doctrine\ORM\EntityManager::clear() with any arguments to clear specific entities is deprecated and will not be supported in Doctrine ORM 3.0. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Calling Doctrine\\ORM\\EntityManager::clear() with any arguments to clear specific entities is deprecated and will not be supported in Doctrine ORM 3.0. at /var/www/app/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:562)"} []

Current behavior

Doctrine\ORM\EntityRepository::clear does not any input and passes the call to $this->_em->clear($this->_class->rootEntityName);.

I think we can just remove the $this->_class->rootEntityName argument here:
a416a9a8b2/lib/Doctrine/ORM/EntityRepository.php (L133-L136)

Originally created by @ruudk on GitHub (Nov 26, 2019). Originally assigned to: @lcobucci on GitHub. ### Bug Report | Q | A |------------ | ------ | BC Break |no | Version | 2.7.0 #### Summary Calling `Doctrine\ORM\EntityRepository::clear` triggers deprecation message: ``` User Deprecated: Calling Doctrine\ORM\EntityManager::clear() with any arguments to clear specific entities is deprecated and will not be supported in Doctrine ORM 3.0. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Calling Doctrine\\ORM\\EntityManager::clear() with any arguments to clear specific entities is deprecated and will not be supported in Doctrine ORM 3.0. at /var/www/app/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:562)"} [] ``` #### Current behavior `Doctrine\ORM\EntityRepository::clear` does not any input and passes the call to `$this->_em->clear($this->_class->rootEntityName);`. I think we can just remove the `$this->_class->rootEntityName` argument here: https://github.com/doctrine/orm/blob/a416a9a8b2cd2ea0f7b7b5638986e8b398f34df8/lib/Doctrine/ORM/EntityRepository.php#L133-L136
admin added the Deprecation label 2026-01-22 15:31:35 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6352