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

Deprecation: UserListener needs to be done as listener instead of subscriber #1650

Closed
Hanmac opened this issue Jun 12, 2023 · 2 comments · Fixed by #1651
Closed

Deprecation: UserListener needs to be done as listener instead of subscriber #1650

Hanmac opened this issue Jun 12, 2023 · 2 comments · Fixed by #1651
Labels

Comments

@Hanmac
Copy link
Contributor

Hanmac commented Jun 12, 2023

Environment

Sonata packages

show

$ composer show --latest 'sonata-project/*'
# Put the result here.
sonata-project/user-bundle 5.9.0

Symfony packages

show

$ composer show --latest 'symfony/*'
# Put the result here.
symfony/doctrine-bridge v6.3.0

PHP version

$ php -v
# Put the result here.
PHP 8.2.6

Subject

Minimal repository with the bug

Steps to reproduce

Open a Page in Backend and use Profiler to see Deprecations

Expected results

No Deprecations

Actual results

'symfony/doctrine-bridge', '6.3', 'Using Doctrine subscribers as services is deprecated, declare listeners instead'

Because of symfony/symfony#49918 and doctrine/DoctrineBundle#1664,
doctrine.event_subscriber is deprecated and should use listener instead

Should that be done as https://symfony.com/doc/current/doctrine/events.html#doctrine-entity-listeners directly instead of listening to all entities? technically it should not look for Sonata\UserBundle\Model\UserInterface but for sonata.user.user.class ?

for a possible MR, should i still use the php config, or should i use #[AsEntityListener] ?

@jordisala1991
Copy link
Member

jordisala1991 commented Jun 12, 2023

I think we should fix this the same as we did for doctrine extensions: sonata-project/sonata-doctrine-extensions#487

Do you want to do the PR?

@Hanmac
Copy link
Contributor Author

Hanmac commented Jun 12, 2023

@jordisala1991 yeah i can, i think

i was just looking if i could use an entity-listener instead of a full one (so it only needs to listen to one class anyway? not just the UserInterface?)
but it seems that such option doesn't exist for doctrine_mongodb.odm.event_listener and the ODM stuff, so it seems i still need to use the full listener for both

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 a pull request may close this issue.

2 participants