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

Avoid triggering deprecation when calling UnitOfWork::clear() #2511

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

franmomu
Copy link
Contributor

@franmomu franmomu commented Mar 12, 2023

Q A
Type task
BC Break no
Fixed issues

Summary

When calling UnitOfWork::clear() without argument it always triggers a deprecation (using doctrine/persistence 3) because it's passing a value to OnClearEventArgs::__construct():

/** @param class-string|null $entityClass */
public function __construct($objectManager, $entityClass = null)
{
if (method_exists(parent::class, 'getEntityClass') && $entityClass !== null) {
parent::__construct($objectManager, $entityClass);
} else {
if (func_num_args() > 1) {
trigger_deprecation(
'doctrine/mongodb-odm',
'2.4',
'Passing $entityClass argument to %s::%s() is deprecated and will not be supported in Doctrine ODM 3.0.',
self::class,
__METHOD__,
);
}
parent::__construct($objectManager);
}
$this->entityClass = $entityClass;
}

The deprecation can be seen in https://github.com/doctrine/DoctrineMongoDBBundle/actions/runs/4363102968/jobs/7628786971#step:10:30

When calling UnitOfWork::clear() without argument
@franmomu franmomu added the Task label Mar 12, 2023
@franmomu franmomu added this to the 2.5.1 milestone Mar 12, 2023
@franmomu franmomu changed the title Avoid triggering deprecation Avoid triggering deprecation when calling UnitOfWork::clear() Mar 12, 2023
@franmomu franmomu merged commit d6911d9 into doctrine:2.5.x Mar 15, 2023
@franmomu franmomu deleted the patch/avoid_deprecation_on_clear branch March 15, 2023 07:03
alcaeus added a commit to alcaeus/mongodb-odm that referenced this pull request Mar 29, 2023
* 2.5.x:
  Use static data providers (doctrine#2512)
  Avoid triggering deprecation (doctrine#2511)
  Remove occurrences of "$this" in data providers
  Rename abstract test classes to *TestCase (doctrine#2507)
  Update branch metadata (doctrine#2508)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants