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

cli-config.php compatibility with DBAL #8327

Closed
PowerKiKi opened this issue Nov 4, 2020 · 2 comments · Fixed by #8524
Closed

cli-config.php compatibility with DBAL #8327

PowerKiKi opened this issue Nov 4, 2020 · 2 comments · Fixed by #8524
Milestone

Comments

@PowerKiKi
Copy link
Contributor

PowerKiKi commented Nov 4, 2020

Since DBAL 2.11.0 and doctrine/dbal#3956, it is now deprecated to use HelperSet in cli-config.php. This will become impossible in DBAL 3, following doctrine/dbal#4059.

This means that, in order to keep sharing a single config file for both packages, this package should also accept the new \Doctrine\DBAL\Tools\Console\ConnectionProvider. It could actually be a new interface along the lines of:

namespace \Doctrine\ORM\Tools\Console;

interface EntityManagerProvider
    public function getEntityManager(string $name) : EntityManagerInterface;
}

I suppose the support of HelperSet could be drop entirely in the next major version too. So long we can use a HelperSetManagerProvider that extends the EntityManagerProvider.

All commands must be adjusted to access the entity manager from a provider instead of the HelperSet. Deprecation messages when using HelperSet must be thrown appropriately.

See related doctrine/migrations#1070

@beberlei beberlei added this to the 2.9.0 milestone Dec 6, 2020
beberlei added a commit to beberlei/doctrine2 that referenced this issue Mar 6, 2021
beberlei added a commit to beberlei/doctrine2 that referenced this issue Mar 6, 2021
beberlei added a commit to beberlei/doctrine2 that referenced this issue Mar 6, 2021
beberlei added a commit to beberlei/doctrine2 that referenced this issue Mar 6, 2021
@beberlei
Copy link
Member

beberlei commented Mar 6, 2021

I have updated the description of the issue to explain my approach to performing this deprecation:

  1. Introduce EntityManagerProvider as mentioned
  2. Introduce a HelperSetManagerProvider that is used and introduced for the deprecated legacy case in ConsoleRunner
  3. Introduce AbstractEntityManagerCommand that each command implements. Provide backwards compatibility with other packages extending Doctrine commands.

beberlei added a commit to beberlei/doctrine2 that referenced this issue Mar 28, 2021
beberlei added a commit to beberlei/doctrine2 that referenced this issue Apr 10, 2021
beberlei added a commit to beberlei/doctrine2 that referenced this issue Apr 11, 2021
beberlei added a commit to beberlei/doctrine2 that referenced this issue Apr 11, 2021
beberlei added a commit to beberlei/doctrine2 that referenced this issue Apr 18, 2021
beberlei added a commit to beberlei/doctrine2 that referenced this issue Apr 18, 2021
beberlei added a commit that referenced this issue Apr 18, 2021
…8524)

* cli config

* [GH-8327] Deprecate EntityManager HelperSet for a provider abstraction.

* Housekeeping: phpcs

* [GH-8327] Refactor tests towards use of SingleManagerProvider instead of HelperSet.

* [GH-8327] Refactor tests towards use of SingleManagerProvider instead of HelperSet.

* [GH-8327] Refactor tests towards use of SingleManagerProvider instead of HelperSet.

* Housekeeping: cs

* Update tests/Doctrine/Tests/ORM/Tools/Console/ConsoleRunnerTest.php

Co-authored-by: Grégoire Paris <[email protected]>

* [GH-8327] Change option from entity-manager to em for consistency with DoctrineBundle.

* Add final to new methods and classes

Co-authored-by: Grégoire Paris <[email protected]>

* [GH-8327] Bugfix: phpstan detected stricter type checks needed.

* phpcs

Co-authored-by: Grégoire Paris <[email protected]>
@beberlei
Copy link
Member

Merged #8524 into 2.9.x

beberlei added a commit to beberlei/doctrine2 that referenced this issue Apr 20, 2021
beberlei added a commit to beberlei/doctrine2 that referenced this issue Apr 25, 2021
beberlei added a commit that referenced this issue Apr 25, 2021
…eBundle usage (#8646)

* [GH-8327] Make EntityManagerProvider compatible with expected DoctrineBundle usage.

* phpcs

* [Gh-8327] Delegate to EntityManagerProvider::getDefaultManager in ConnectionFromManagerProvider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants