File tree Expand file tree Collapse file tree 7 files changed +60
-2
lines changed Expand file tree Collapse file tree 7 files changed +60
-2
lines changed Original file line number Diff line number Diff line change @@ -18,16 +18,25 @@ public function __construct(SearchService $searchService)
18
18
19
19
public function postUpdate (LifecycleEventArgs $ args ): void
20
20
{
21
+ if (!$ this ->searchService ->isSearchable ($ args ->getObject ())) {
22
+ return ;
23
+ }
21
24
$ this ->searchService ->index ($ args ->getObjectManager (), $ args ->getObject ());
22
25
}
23
26
24
27
public function postPersist (LifecycleEventArgs $ args ): void
25
28
{
29
+ if (!$ this ->searchService ->isSearchable ($ args ->getObject ())) {
30
+ return ;
31
+ }
26
32
$ this ->searchService ->index ($ args ->getObjectManager (), $ args ->getObject ());
27
33
}
28
34
29
35
public function preRemove (LifecycleEventArgs $ args ): void
30
36
{
37
+ if (!$ this ->searchService ->isSearchable ($ args ->getObject ())) {
38
+ return ;
39
+ }
31
40
$ this ->searchService ->remove ($ args ->getObjectManager (), $ args ->getObject ());
32
41
}
33
42
}
Original file line number Diff line number Diff line change 5
5
namespace Meilisearch \Bundle \Services ;
6
6
7
7
use Doctrine \Common \Util \ClassUtils ;
8
+ use Doctrine \ORM \Mapping \LegacyReflectionFields ;
8
9
use Doctrine \ORM \Proxy \DefaultProxyClassNameResolver ;
9
10
use Doctrine \Persistence \ObjectManager ;
10
11
use Meilisearch \Bundle \Collection ;
@@ -374,6 +375,11 @@ private static function resolveClass(object $object): string
374
375
static $ resolver ;
375
376
376
377
$ resolver ??= (function () {
378
+ // Native lazy objects compatibility
379
+ if (class_exists (LegacyReflectionFields::class)) {
380
+ return fn ($ object ) => $ object ::class;
381
+ }
382
+
377
383
// Doctrine ORM v3+ compatibility
378
384
if (class_exists (DefaultProxyClassNameResolver::class)) {
379
385
return fn (object $ object ) => DefaultProxyClassNameResolver::getClass ($ object );
Original file line number Diff line number Diff line change 4
4
5
5
namespace Meilisearch \Bundle \Tests \Integration ;
6
6
7
+ use Doctrine \ORM \Mapping \LegacyReflectionFields ;
7
8
use Doctrine \Persistence \Proxy ;
8
9
use Meilisearch \Bundle \Exception \EntityNotFoundInObjectID ;
9
10
use Meilisearch \Bundle \Exception \InvalidEntityForAggregator ;
@@ -35,6 +36,10 @@ public function testConstructor(): void
35
36
36
37
public function testAggregatorProxyClass (): void
37
38
{
39
+ if (class_exists (LegacyReflectionFields::class)) {
40
+ $ this ->markTestSkipped ('Skipping, because proxies are not wrapped anymore with lazy native objects. ' );
41
+ }
42
+
38
43
$ this ->entityManager ->persist ($ post = new Post ());
39
44
$ this ->entityManager ->flush ();
40
45
$ postId = $ post ->getId ();
Original file line number Diff line number Diff line change 7
7
use Doctrine \Bundle \DoctrineBundle \ConnectionFactory ;
8
8
use Doctrine \Bundle \DoctrineBundle \DoctrineBundle ;
9
9
use Doctrine \ORM \Configuration ;
10
+ use Doctrine \ORM \Mapping \LegacyReflectionFields ;
10
11
use Meilisearch \Bundle \MeilisearchBundle ;
11
12
use Symfony \Bridge \Doctrine \ArgumentResolver \EntityValueResolver ;
12
13
use Symfony \Bundle \FrameworkBundle \FrameworkBundle ;
@@ -29,7 +30,11 @@ public function registerBundles(): iterable
29
30
protected function configureContainer (ContainerBuilder $ container , LoaderInterface $ loader ): void
30
31
{
31
32
if (PHP_VERSION_ID >= 80000 ) {
32
- $ loader ->load (__DIR__ .'/config/config.yaml ' );
33
+ if (class_exists (LegacyReflectionFields::class) && PHP_VERSION_ID >= 80400 ) {
34
+ $ loader ->load (__DIR__ .'/config/config.yaml ' );
35
+ } else {
36
+ $ loader ->load (__DIR__ .'/config/config_old_proxy.yaml ' );
37
+ }
33
38
} else {
34
39
$ loader ->load (__DIR__ .'/config/config_php7.yaml ' );
35
40
}
Original file line number Diff line number Diff line change 1
1
%Method "ArrayAccess::offsetGet\(\)" might add "mixed" as a native return type declaration in the future. Do the same in implementation "Meilisearch\\Contracts\\Data" now to avoid errors or add an explicit @return annotation to suppress this message.%
2
2
%Since symfony/var-exporter 7.3: The "Symfony\\Component\\VarExporter\\LazyGhostTrait" trait is deprecated, use native lazy objects instead.%
3
3
%Since symfony/var-exporter 7.3: Using ProxyHelper::generateLazyGhost\(\) is deprecated, use native lazy objects instead.%
4
+ %Class "Doctrine\\ORM\\Proxy\\Autoloader" is deprecated. Use native lazy objects instead.%
5
+ %Calling Doctrine\\ORM\\Configuration::setProxyDir is deprecated and will not be possible in Doctrine ORM 4.0%
6
+ %Calling Doctrine\\ORM\\Configuration::getProxyDir is deprecated and will not be possible in Doctrine ORM 4.0%
7
+ %Calling Doctrine\\ORM\\Configuration::setAutoGenerateProxyClasses is deprecated and will not be possible in Doctrine ORM 4.0%
8
+ %Calling Doctrine\\ORM\\Configuration::getAutoGenerateProxyClasses is deprecated and will not be possible in Doctrine ORM 4.0%
9
+ %Calling Doctrine\\ORM\\Configuration::setProxyNamespace is deprecated and will not be possible in Doctrine ORM 4.0%
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ doctrine:
13
13
types :
14
14
dummy_object_id : Meilisearch\Bundle\Tests\Dbal\Type\DummyObjectIdType
15
15
orm :
16
- auto_generate_proxy_classes : true
16
+ enable_native_lazy_objects : true
17
+ auto_generate_proxy_classes : false
17
18
report_fields_where_declared : true
18
19
naming_strategy : doctrine.orm.naming_strategy.underscore_number_aware
19
20
auto_mapping : true
Original file line number Diff line number Diff line change
1
+ framework :
2
+ test : true
3
+ secret : 67d829bf61dc5f87a73fd814e2c9f629
4
+ http_method_override : false
5
+
6
+ doctrine :
7
+ dbal :
8
+ default_connection : default
9
+ connections :
10
+ default :
11
+ driver : pdo_sqlite
12
+ path : ' %kernel.cache_dir%/test.sqlite'
13
+ types :
14
+ dummy_object_id : Meilisearch\Bundle\Tests\Dbal\Type\DummyObjectIdType
15
+ orm :
16
+ auto_generate_proxy_classes : true
17
+ report_fields_where_declared : true
18
+ naming_strategy : doctrine.orm.naming_strategy.underscore_number_aware
19
+ auto_mapping : true
20
+ mappings :
21
+ App :
22
+ is_bundle : false
23
+ type : attribute
24
+ dir : ' %kernel.project_dir%/tests/Entity'
25
+ prefix : ' Meilisearch\Bundle\Tests\Entity'
26
+ alias : App
You can’t perform that action at this time.
0 commit comments