EntityManager calls Connection::getEventManager() which is deprecated since doctrine/dbal:3.5.0 #7064

Closed
opened 2026-01-22 15:43:59 +01:00 by admin · 10 comments
Owner

Originally created by @W0rma on GitHub (Oct 24, 2022).

Bug Report

Q A
BC Break no
Version 2.13.3

Summary

I noticed the following deprecation warning after upgrading to doctrine/dbal:3.5.0:

Doctrine\DBAL\Connection::getEventManager is deprecated. (Connection.php:273 called by EntityManager.php:1001, https://github.com/doctrine/dbal/issues/5784, package doctrine/dbal)

Originally created by @W0rma on GitHub (Oct 24, 2022). ### Bug Report | Q | A |------------ | ------ | BC Break | no | Version | 2.13.3 #### Summary I noticed the following deprecation warning after upgrading to `doctrine/dbal:3.5.0`: `Doctrine\DBAL\Connection::getEventManager is deprecated. (Connection.php:273 called by EntityManager.php:1001, https://github.com/doctrine/dbal/issues/5784, package doctrine/dbal)`
admin closed this issue 2026-01-22 15:44:00 +01:00
Author
Owner

@derrabus commented on GitHub (Oct 24, 2022):

We have addressed this deprecation in 2.14 already, but we won't get rid of that call entirely before 3.0, I'm afraid.

@derrabus commented on GitHub (Oct 24, 2022): We have addressed this deprecation in 2.14 already, but we won't get rid of that call entirely before 3.0, I'm afraid.
Author
Owner

@greg0ire commented on GitHub (Oct 24, 2022):

We have addressed this deprecation in 2.14 already

Have we? I didn't do that in https://github.com/doctrine/orm/pull/10153

@greg0ire commented on GitHub (Oct 24, 2022): > We have addressed this deprecation in 2.14 already Have we? I didn't do that in https://github.com/doctrine/orm/pull/10153
Author
Owner

@derrabus commented on GitHub (Oct 24, 2022):

Yes, in #9961.

@derrabus commented on GitHub (Oct 24, 2022): Yes, in #9961.
Author
Owner

@ruudk commented on GitHub (Jun 2, 2023):

Would it be possible to somehow silence the deprecation as there is no way to solve it for end users?

1x: Doctrine\DBAL\Connection::getEventManager is deprecated. (Connection.php:296 called by EntityManager.php:167, https://github.com/doctrine/dbal/issues/5784, package doctrine/dbal)

@ruudk commented on GitHub (Jun 2, 2023): Would it be possible to somehow silence the deprecation as there is no way to solve it for end users? > 1x: Doctrine\DBAL\Connection::getEventManager is deprecated. (Connection.php:296 called by EntityManager.php:167, https://github.com/doctrine/dbal/issues/5784, package doctrine/dbal)
Author
Owner

@greg0ire commented on GitHub (Jun 2, 2023):

Hiding indirect deprecation is the concern of symfony/phpunit-bridge, isn't it?

@greg0ire commented on GitHub (Jun 2, 2023): Hiding indirect deprecation is the concern of `symfony/phpunit-bridge`, isn't it?
Author
Owner

@ruudk commented on GitHub (Jun 2, 2023):

Sure, but now the Doctrine organization shows deprecations for their own packages. It would be great if a deprecation in dbal would not be triggered if it originated from orm in cases were there is no solution other than major bump. Especially as end users cannot do anything about it.

We run our tests with phpunit-bridge and show all deprecations, including indirect, so that we can report (and sometimes fix) these problems in our dependencies. It's a pitty to see some deprecations for months, because there is no solution.

@ruudk commented on GitHub (Jun 2, 2023): Sure, but now the Doctrine organization shows deprecations for their own packages. It would be great if a deprecation in dbal would not be triggered if it originated from orm in cases were there is no solution other than major bump. Especially as end users cannot do anything about it. We run our tests with phpunit-bridge and show all deprecations, including indirect, so that we can report (and sometimes fix) these problems in our dependencies. It's a pitty to see some deprecations for months, because there is no solution.
Author
Owner

@greg0ire commented on GitHub (Jun 2, 2023):

the Doctrine organization shows deprecations for their own packages.

No, the PHPUnit bridge/ the Symfony framework bundle do that. We don't show anything. But to answer your question, you as an end user can silence specific deprecations: https://github.com/doctrine/deprecations/#suppressing-specific-deprecations

It would be great if a deprecation in dbal would not be triggered if it originated from orm in cases were there is no solution other than major bump. Especially as end users cannot do anything about it.

Maybe that's something you would want to report to doctrine/deprecations ?

@greg0ire commented on GitHub (Jun 2, 2023): > the Doctrine organization shows deprecations for their own packages. No, the PHPUnit bridge/ the Symfony framework bundle do that. We don't show anything. But to answer your question, you as an end user can silence specific deprecations: https://github.com/doctrine/deprecations/#suppressing-specific-deprecations > It would be great if a deprecation in dbal would not be triggered if it originated from orm in cases were there is no solution other than major bump. Especially as end users cannot do anything about it. Maybe that's something you would want to report to `doctrine/deprecations` ?
Author
Owner

@derrabus commented on GitHub (Jun 2, 2023):

I'm on a phone right now and cannot investigate further atm. If you're getting this deprecation in a Symfony app, DoctrineBundle would be the place to fix it.

@derrabus commented on GitHub (Jun 2, 2023): I'm on a phone right now and cannot investigate further atm. If you're getting this deprecation in a Symfony app, DoctrineBundle would be the place to fix it.
Author
Owner

@greg0ire commented on GitHub (Jun 2, 2023):

@ruudk I think you might want to try to use SYMFONY_DEPRECATIONS_HELPER=/getEventManager/ vendor/bin/phpunit` to get a full stack trace (I'm not sure if that will work properly, but you can try). It will help confirm that it comes indeed from the bundle. Also see: https://github.com/doctrine/DoctrineBundle/issues/1665#issuecomment-1570978881

@greg0ire commented on GitHub (Jun 2, 2023): @ruudk I think you might want to try to use `SYMFONY_DEPRECATIONS_HELPER=/getEventManager/` vendor/bin/phpunit` to get a full stack trace (I'm not sure if that will work properly, but you can try). It will help confirm that it comes indeed from the bundle. Also see: https://github.com/doctrine/DoctrineBundle/issues/1665#issuecomment-1570978881
Author
Owner

@dmaicher commented on GitHub (Jun 2, 2023):

Will be fixed on DoctrineBundle soon. See https://github.com/doctrine/DoctrineBundle/pull/1667

@dmaicher commented on GitHub (Jun 2, 2023): Will be fixed on DoctrineBundle soon. See https://github.com/doctrine/DoctrineBundle/pull/1667
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7064