Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 122a096

Browse filesBrowse files
committed
fix: don't register doctrine:mapping:import when using ORM v3
1 parent 6c73d5f commit 122a096
Copy full SHA for 122a096

2 files changed

+9-2Lines changed: 9 additions & 2 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎DependencyInjection/DoctrineExtension.php‎

Copy file name to clipboardExpand all lines: DependencyInjection/DoctrineExtension.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Doctrine\ORM\Proxy\Autoloader;
2222
use Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand;
2323
use Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand;
24+
use Doctrine\ORM\Tools\Export\ClassMetadataExporter;
2425
use Doctrine\ORM\UnitOfWork;
2526
use LogicException;
2627
use Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension;
@@ -471,6 +472,10 @@ protected function ormLoad(array $config, ContainerBuilder $container)
471472
$container->removeDefinition('doctrine.ensure_production_settings_command');
472473
}
473474

475+
if (! class_exists(ClassMetadataExporter::class)) {
476+
$container->removeDefinition('doctrine.mapping_import_command');
477+
}
478+
474479
$entityManagers = [];
475480
foreach (array_keys($config['entity_managers']) as $name) {
476481
$entityManagers[$name] = sprintf('doctrine.orm.%s_entity_manager', $name);
Collapse file

‎Tests/Command/ImportMappingDoctrineCommandTest.php‎

Copy file name to clipboardExpand all lines: Tests/Command/ImportMappingDoctrineCommandTest.php
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44

55
use Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\Fixtures\TestKernel;
66
use Doctrine\ORM\EntityManagerInterface;
7+
use Doctrine\ORM\Tools\Export\ClassMetadataExporter;
78
use InvalidArgumentException;
89
use PHPUnit\Framework\TestCase;
910
use Symfony\Bundle\FrameworkBundle\Console\Application;
1011
use Symfony\Component\Console\Tester\CommandTester;
1112
use Symfony\Component\Filesystem\Filesystem;
1213
use Symfony\Component\HttpKernel\Bundle\Bundle;
1314

15+
use function class_exists;
1416
use function file_get_contents;
1517
use function interface_exists;
1618
use function sys_get_temp_dir;
@@ -26,11 +28,11 @@ class ImportMappingDoctrineCommandTest extends TestCase
2628

2729
public static function setUpBeforeClass(): void
2830
{
29-
if (interface_exists(EntityManagerInterface::class)) {
31+
if (interface_exists(EntityManagerInterface::class) && class_exists(ClassMetadataExporter::class)) {
3032
return;
3133
}
3234

33-
self::markTestSkipped('This test requires ORM');
35+
self::markTestSkipped('This test requires ORM version 2');
3436
}
3537

3638
protected function setup(): void

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.