Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove methods related to partial clearing #272

Merged
merged 1 commit into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
55 changes: 1 addition & 54 deletions src/Persistence/Event/OnClearEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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;
}

/**
Expand All @@ -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;
}
}