Skip to content

Commit 814f872

Browse files
committed
Fix test and deprecation
1 parent fe315e7 commit 814f872

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

tests/Integration/AggregatorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Meilisearch\Bundle\Tests\Integration;
66

7+
use Doctrine\Persistence\Proxy;
78
use Meilisearch\Bundle\Exception\EntityNotFoundInObjectID;
89
use Meilisearch\Bundle\Exception\InvalidEntityForAggregator;
910
use Meilisearch\Bundle\Tests\BaseKernelTestCase;
@@ -35,11 +36,10 @@ public function testConstructor(): void
3536
public function testAggregatorProxyClass(): void
3637
{
3738
$this->createPost();
39+
$this->entityManager->clear();
3840

39-
$postMetadata = $this->entityManager->getClassMetadata(Post::class);
40-
$this->entityManager->getProxyFactory()->generateProxyClasses([$postMetadata]);
41-
42-
$proxy = $this->entityManager->getProxyFactory()->getProxy($postMetadata->getName(), ['id' => 1]);
41+
$proxy = $this->entityManager->getReference(Post::class, 1);
42+
$this->assertInstanceOf(Proxy::class, $proxy);
4343
$contentAggregator = new ContentAggregator($proxy, ['objectId']);
4444

4545
/** @var Serializer $serializer */

tests/Kernel.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,27 @@
44

55
namespace Meilisearch\Bundle\Tests;
66

7+
use Doctrine\Bundle\DoctrineBundle\ConnectionFactory;
78
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
89
use Meilisearch\Bundle\MeilisearchBundle;
910
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
11+
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
1012
use Symfony\Component\Config\Loader\LoaderInterface;
11-
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
13+
use Symfony\Component\DependencyInjection\ContainerBuilder;
1214
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
1315

14-
/**
15-
* Class Kernel.
16-
*/
1716
class Kernel extends HttpKernel
1817
{
19-
/**
20-
* @return array<int, BundleInterface>
21-
*/
22-
public function registerBundles(): array
18+
use MicroKernelTrait;
19+
20+
public function registerBundles(): iterable
2321
{
24-
return [
25-
new FrameworkBundle(),
26-
new DoctrineBundle(),
27-
new MeilisearchBundle(),
28-
];
22+
yield new FrameworkBundle();
23+
yield new DoctrineBundle();
24+
yield new MeilisearchBundle();
2925
}
3026

31-
public function registerContainerConfiguration(LoaderInterface $loader): void
27+
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
3228
{
3329
if (PHP_VERSION_ID >= 80000) {
3430
$loader->load(__DIR__.'/config/config.yaml');
@@ -37,5 +33,13 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
3733
}
3834
$loader->load(__DIR__.'/../config/services.xml');
3935
$loader->load(__DIR__.'/config/meilisearch.yaml');
36+
37+
if (defined(ConnectionFactory::class.'::DEFAULT_SCHEME_MAP')) {
38+
$container->prependExtensionConfig('doctrine', [
39+
'orm' => [
40+
'report_fields_where_declared' => true,
41+
],
42+
]);
43+
}
4044
}
4145
}

tests/config/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ doctrine:
1313
orm:
1414
auto_generate_proxy_classes: true
1515
validate_xml_mapping: true
16+
report_fields_where_declared: true
1617
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
1718
auto_mapping: true
1819
mappings:

0 commit comments

Comments
 (0)