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

Undeprecate LifecycleEventArgs #9980

Merged
merged 1 commit into from
Aug 8, 2022

Conversation

franmomu
Copy link
Contributor

@franmomu franmomu commented Aug 8, 2022

In #9906 I didn't think about what that meant when using event subscribers.

Deprecating this class means that users using SA tools have to update their code specifying the ObjectManager implementation.

From

use use Doctrine\ORM\Event\LifecycleEventArgs;

public function postLoad(LifecycleEventArgs $args) {
    $blockItem = $args->getObject();
    // ...
}

to:

use Doctrine\Persistence\Event\LifecycleEventArgs;

/**
 * @param LifecycleEventArgs<EntityManagerInterface> $args
 */
public function postLoad(LifecycleEventArgs $args) {
    $blockItem = $args->getObject();
    // ...
}

That's a bad DX, instead of this, we can create specific classes for each event and deprecate this class again when doing so and we don't make users to change their code twice (if they want to use the dedicate classes).

Deprecating this class means that users using SA tools have to
update their code specifying the ObjectManager implementation.

Instead of this, dedicated classes for each event should be
created before deprecating this class.
@derrabus derrabus added this to the 2.13.1 milestone Aug 8, 2022
@derrabus derrabus merged commit 0215b6b into doctrine:2.13.x Aug 8, 2022
@franmomu franmomu deleted the undeprecate_lifecycleeventargs branch August 8, 2022 09:09
derrabus added a commit to derrabus/orm that referenced this pull request Aug 8, 2022
* 2.14.x:
  Backport type fixes for EntityListenerResolver (doctrine#9977)
  Undeprecate LifecycleEventArgs (doctrine#9980)
  Update documentation to not use deprecated method (doctrine#9979)
@guillaumesmo
Copy link

Question: the class has been undeprecated, yet the deprecation "The %s class is deprecated and will be removed in ORM 3.0. Use %s instead." in the constructor hasn't been reverted; is that intentional?

@guillaumesmo
Copy link

answering myself for future reference: it was deprecated again in ORM version 2.14 #10086

n-e-m-a-nj-a pushed a commit to n-e-m-a-nj-a/orm that referenced this pull request Jan 27, 2023
Deprecating this class means that users using SA tools have to
update their code specifying the ObjectManager implementation.

Instead of this, dedicated classes for each event should be
created before deprecating this class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants