Skip to content

Commit

Permalink
Address deprecation from DoctrineBundle
Browse files Browse the repository at this point in the history
The deprecation can only be addressed for recent enough versions of the
bundle, which are quite hard to detect.
  • Loading branch information
greg0ire committed Mar 25, 2024
1 parent 74d3c0f commit 4479e12
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Tests/DependencyInjection/DoctrineMigrationsExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Doctrine\Bundle\MigrationsBundle\Tests\DependencyInjection;

use Composer\InstalledVersions;
use Composer\Semver\VersionParser;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\CacheCompatibilityPass;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension;
use Doctrine\Bundle\DoctrineBundle\Registry;
Expand Down Expand Up @@ -285,6 +287,10 @@ public function testPrefersEntityManagerOverConnection(): void
'migrations_paths' => ['DoctrineMigrationsTest' => 'a'],
];
$ormConfig = trait_exists(LazyGhostTrait::class) ? ['enable_lazy_ghost_objects' => true] : [];
if (InstalledVersions::satisfies(new VersionParser(), 'doctrine/doctrine-bundle', '^2.7.1 ')) {
$ormConfig['controller_resolver'] = ['auto_mapping' => false];
}

$container = $this->getContainer($config, null, $ormConfig);

$container->compile();
Expand Down Expand Up @@ -349,6 +355,10 @@ public function testCustomEntityManager(): void
'acb' => null,
],
];
if (InstalledVersions::satisfies(new VersionParser(), 'doctrine/doctrine-bundle', '^2.7.1 ')) {
$ormConfig['controller_resolver'] = ['auto_mapping' => false];
}

if (trait_exists(LazyGhostTrait::class)) {
$ormConfig['enable_lazy_ghost_objects'] = true;
}
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"doctrine/migrations": "^3.2"
},
"require-dev": {
"composer/semver": "^3.0",
"phpunit/phpunit": "^8.5|^9.5",
"doctrine/coding-standard": "^12",
"phpstan/phpstan": "^1.4",
Expand Down

0 comments on commit 4479e12

Please sign in to comment.