From f86d8a32b5f582cfc940d8570781e1db4346fc11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 29 Mar 2022 18:48:37 +0200 Subject: [PATCH] Remove methods related to partial clearing --- UPGRADE.md | 6 +++ src/Persistence/Event/OnClearEventArgs.php | 55 +--------------------- 2 files changed, 7 insertions(+), 54 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 052de4e8..ab39e442 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -8,6 +8,12 @@ awareness about deprecated code. # Upgrade to 3.0 +## Removed `OnClearEventArgs::clearsAllEntities()` and `OnClearEventArgs::getEntityClass()` + +These methods only make sense when partially clearing the object manager, which +is no longer possible. +The second argument of the constructor of `OnClearEventArgs` is removed as well. + ## BC Break: removed `ObjectManagerAware` Implement active record style functionality directly in your application, by diff --git a/src/Persistence/Event/OnClearEventArgs.php b/src/Persistence/Event/OnClearEventArgs.php index c6e93a3e..c769bfda 100644 --- a/src/Persistence/Event/OnClearEventArgs.php +++ b/src/Persistence/Event/OnClearEventArgs.php @@ -5,11 +5,8 @@ namespace Doctrine\Persistence\Event; use Doctrine\Common\EventArgs; -use Doctrine\Deprecations\Deprecation; use Doctrine\Persistence\ObjectManager; -use function func_num_args; - /** * Provides event arguments for the onClear event. */ @@ -18,26 +15,12 @@ class OnClearEventArgs extends EventArgs /** @var ObjectManager */ private $objectManager; - /** @var string|null */ - private $entityClass; - /** * @param ObjectManager $objectManager The object manager. - * @param string|null $entityClass The optional entity class. */ - public function __construct(ObjectManager $objectManager, ?string $entityClass = null) + public function __construct(ObjectManager $objectManager) { - if (func_num_args() > 1) { - Deprecation::trigger( - 'doctrine/persistence', - 'https://github.com/doctrine/persistence/pull/270', - 'The second argument of %s is deprecated and will be removed in 3.0.', - __METHOD__ - ); - } - $this->objectManager = $objectManager; - $this->entityClass = $entityClass; } /** @@ -49,40 +32,4 @@ public function getObjectManager() { return $this->objectManager; } - - /** - * @deprecated no replacement planned - * Returns the name of the entity class that is cleared, or null if all are cleared. - * - * @return string|null - */ - public function getEntityClass() - { - Deprecation::trigger( - 'doctrine/persistence', - 'https://github.com/doctrine/persistence/pull/270', - '%s is deprecated and will be removed in 3.0', - __METHOD__ - ); - - return $this->entityClass; - } - - /** - * @deprecated no replacement planned - * Returns whether this event clears all entities. - * - * @return bool - */ - public function clearsAllEntities() - { - Deprecation::trigger( - 'doctrine/persistence', - 'https://github.com/doctrine/persistence/pull/270', - '%s is deprecated and will be removed in 3.0', - __METHOD__ - ); - - return $this->entityClass === null; - } }