-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[GH-8327] Deprecate EntityManagerHelper for a provider abstraction. #8524
Conversation
… instead of HelperSet.
… instead of HelperSet.
… instead of HelperSet.
public function getManager(string $name = 'default'): EntityManagerInterface | ||
{ | ||
if ($name !== 'default') { | ||
throw UnknownManagerException::unknownManager($name, ['default']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that people define several managers but end up using SingleManagerProvider
? If yes, that exception will be confusing I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, let's test this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No the SingleManagerProvider
is for non Symfony context, where usually you have only one and you don't care about any of this. :)
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
…ency with DoctrineBundle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The code suggestions I added are just that: suggestions
lib/Doctrine/ORM/Tools/Console/Command/AbstractEntityManagerCommand.php
Outdated
Show resolved
Hide resolved
lib/Doctrine/ORM/Tools/Console/EntityManagerProvider/ConnectionFromManagerProvider.php
Outdated
Show resolved
Hide resolved
lib/Doctrine/ORM/Tools/Console/EntityManagerProvider/HelperSetManagerProvider.php
Outdated
Show resolved
Hide resolved
lib/Doctrine/ORM/Tools/Console/EntityManagerProvider/SingleManagerProvider.php
Outdated
Show resolved
Hide resolved
lib/Doctrine/ORM/Tools/Console/EntityManagerProvider/UnknownManagerException.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
@beberlei adding |
@dominikzogg we speifically added code to prevent breaking in doctrine Bundle |
@beberlei as mentioned: there is code outside the symfony ecosystem out there https://github.com/chubbyphp/chubbyphp-laminas-config-doctrine/pull/3/files and i am not even done yet => will lead to a major release on my side and when orm 3.0 gets released another major cause i am sure there will be (expected) bc's |
Adding any parameter could have caused this, others might use |
do it in 3.0, so nobody get forced to update code immediately |
That ship has sailed :) |
Deprecates the
EntityManagerHelper
in favor of a newEntityManagerProvider
interface that comes with two implementation.HelpersetManagerProvider
SingleManagerProvider
that provides access to a single entity manager.In addition an implementation for the DBAL
ConnectionProvider
is provided that is based on anyEntityManagerProvider
and callinggetConnection()
on the EntityManager.It is expected for the DoctrineBundle to create a new
EntityManagerProvider
that provides access to their multiple ORM entity managers via the Symfony DI Container.Two deprecation messages are added:
HelperSetManagerProvider
must be used from withinConsoleRunner
, because aHelperSet
is passed.EntityManagerProvider
as a dependency.Todos:
Fixes #8327