Skip to content

Commit

Permalink
Remove support for Symfony 5 (#576)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus authored Jan 13, 2025
1 parent c223806 commit b9d29ea
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 36 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"require": {
"php": "^8.1",
"symfony/deprecation-contracts": "^2.1 || ^3",
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0",
"doctrine/doctrine-bundle": "^2.4",
"symfony/framework-bundle": "^6.4 || ^7.0",
"doctrine/doctrine-bundle": "^2.8",
"doctrine/migrations": "^3.2"
},
"require-dev": {
Expand All @@ -35,9 +35,9 @@
"phpstan/phpstan-phpunit": "^2",
"phpstan/phpstan-strict-rules": "^2",
"phpstan/phpstan-symfony": "^2",
"doctrine/orm": "^2.6 || ^3",
"doctrine/persistence": "^2.0 || ^3 ",
"symfony/var-exporter": "^6 || ^7"
"doctrine/orm": "^2.15 || ^3",
"doctrine/persistence": "^3.1 ",
"symfony/var-exporter": "^6.4 || ^7"
},
"autoload": {
"psr-4": { "Doctrine\\Bundle\\MigrationsBundle\\": "src" }
Expand Down
55 changes: 24 additions & 31 deletions tests/DependencyInjection/DoctrineMigrationsExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

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 All @@ -31,11 +29,9 @@
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\VarExporter\LazyGhostTrait;

use function assert;
use function sys_get_temp_dir;
use function trait_exists;

class DoctrineMigrationsExtensionTest extends TestCase
{
Expand Down Expand Up @@ -252,15 +248,16 @@ public function testCustomConnection(): void

public function testPrefersEntityManagerOverConnection(): void
{
$config = [
'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 = $this->getContainer(
[
'migrations_paths' => ['DoctrineMigrationsTest' => 'a'],
],
null,
[
'enable_lazy_ghost_objects' => true,
'controller_resolver' => ['auto_mapping' => false],
],
);

$container->compile();

Expand Down Expand Up @@ -314,25 +311,21 @@ public function testRequiresDoctrineBundle(): void

public function testCustomEntityManager(): void
{
$config = [
'em' => 'custom',
'migrations_paths' => ['DoctrineMigrationsTest' => 'a'],
];
$ormConfig = [
'entity_managers' => [
'custom' => null,
'acb' => null,
$container = $this->getContainer(
[
'em' => 'custom',
'migrations_paths' => ['DoctrineMigrationsTest' => 'a'],
],
];
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;
}

$container = $this->getContainer($config, null, $ormConfig);
null,
[
'entity_managers' => [
'custom' => null,
'acb' => null,
],
'controller_resolver' => ['auto_mapping' => false],
'enable_lazy_ghost_objects' => true,
],
);

$container->compile();

Expand Down

0 comments on commit b9d29ea

Please sign in to comment.