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

Deprecate console helper #9641

Merged
merged 1 commit into from
Apr 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Upgrade to 2.12

## Deprecate `Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper`

Using a console helper to provide the ORM's console commands with one or
multiple entity managers had been deprecated with 2.9 already. This leaves
The `EntityManagerHelper` class with no purpose which is why it is now
deprecated too. Applications that still rely on the `em` console helper, can
easily recreate that class in their own codebase.

## Deprecate custom repository classes that don't extend `EntityRepository`

Although undocumented, it is currently possible to configure a custom repository
Expand All @@ -19,7 +27,6 @@ This is now deprecated. Please extend `EntityRepository` instead.
+$entityManager->getRepository(CmsUser::class);
```


## BC Break: `AttributeDriver` and `AnnotationDriver` no longer extends parent class from `doctrine/persistence`

Both these classes used to extend an abstract `AnnotationDriver` class defined
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ final class ConsoleRunner
{
/**
* Create a Symfony Console HelperSet
*
* @deprecated This method will be removed in ORM 3.0 without replacement.
*/
public static function createHelperSet(EntityManagerInterface $entityManager): HelperSet
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

use function assert;

/**
* @deprecated This class will be removed in ORM 3.0 without replacement.
*/
final class HelperSetManagerProvider implements EntityManagerProvider
{
/** @var HelperSet */
Expand Down
10 changes: 9 additions & 1 deletion lib/Doctrine/ORM/Tools/Console/Helper/EntityManagerHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

namespace Doctrine\ORM\Tools\Console\Helper;

use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Helper\Helper;

/**
* Doctrine CLI Connection Helper.
*
* @link www.doctrine-project.org
* @deprecated This class will be removed in ORM 3.0 without replacement.
*/
class EntityManagerHelper extends Helper
{
Expand All @@ -23,6 +24,13 @@ class EntityManagerHelper extends Helper

public function __construct(EntityManagerInterface $em)
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9641',
'The %s class is deprecated and will be removed in ORM 3.0',
self::class
);

$this->_em = $em;
}

Expand Down
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
<referencedClass name="Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand"/>
<referencedClass name="Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand"/>
<referencedClass name="Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand"/>
<referencedClass name="Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper"/>
<referencedClass name="Doctrine\ORM\Tools\Console\EntityManagerProvider\HelperSetManagerProvider"/>
</errorLevel>
</DeprecatedClass>
<DeprecatedConstant>
Expand Down