Skip to content

Commit

Permalink
minor #1431 [ci] handle doctrine lazy ghost deprecation in entity reg…
Browse files Browse the repository at this point in the history
…en tests
  • Loading branch information
jrushlow authored Feb 7, 2024
1 parent 73580f9 commit d261134
Showing 1 changed file with 38 additions and 23 deletions.
61 changes: 38 additions & 23 deletions tests/Doctrine/EntityRegeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\Bundle\MakerBundle\Tests\Doctrine;

use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Doctrine\Persistence\Reflection\RuntimeReflectionProperty;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
Expand Down Expand Up @@ -166,19 +167,26 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
'url' => 'sqlite:///fake',
];

$c->prependExtensionConfig('doctrine', [
'dbal' => $dbal,
'orm' => [
'mappings' => [
'EntityRegenerator' => [
'is_bundle' => false,
'dir' => '%kernel.project_dir%/src/Entity',
'prefix' => 'Symfony\Bundle\MakerBundle\Tests\tmp\current_project\src\Entity',
'alias' => 'EntityRegeneratorApp',
'type' => 'attribute',
],
$orm = [
'mappings' => [
'EntityRegenerator' => [
'is_bundle' => false,
'dir' => '%kernel.project_dir%/src/Entity',
'prefix' => 'Symfony\Bundle\MakerBundle\Tests\tmp\current_project\src\Entity',
'alias' => 'EntityRegeneratorApp',
'type' => 'attribute',
],
],
];

/* @legacy Remove conditional when doctrine/persistence <3.1 are no longer supported. */
if (class_exists(RuntimeReflectionProperty::class)) {
$orm['enable_lazy_ghost_objects'] = true;
}

$c->prependExtensionConfig('doctrine', [
'dbal' => $dbal,
'orm' => $orm,
]);
}

Expand Down Expand Up @@ -219,20 +227,27 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
'url' => 'sqlite:///fake',
];

$c->prependExtensionConfig('doctrine', [
'dbal' => $dbal,
'orm' => [
'auto_generate_proxy_classes' => true,
'mappings' => [
'EntityRegenerator' => [
'is_bundle' => false,
'type' => 'xml',
'dir' => '%kernel.project_dir%/config/doctrine',
'prefix' => 'Symfony\Bundle\MakerBundle\Tests\tmp\current_project_xml\src\Entity',
'alias' => 'EntityRegeneratorApp',
],
$orm = [
'auto_generate_proxy_classes' => true,
'mappings' => [
'EntityRegenerator' => [
'is_bundle' => false,
'type' => 'xml',
'dir' => '%kernel.project_dir%/config/doctrine',
'prefix' => 'Symfony\Bundle\MakerBundle\Tests\tmp\current_project_xml\src\Entity',
'alias' => 'EntityRegeneratorApp',
],
],
];

/* @legacy Remove conditional when doctrine/persistence <3.1 are no longer supported. */
if (class_exists(RuntimeReflectionProperty::class)) {
$orm['enable_lazy_ghost_objects'] = true;
}

$c->prependExtensionConfig('doctrine', [
'dbal' => $dbal,
'orm' => $orm,
]);
}

Expand Down

0 comments on commit d261134

Please sign in to comment.