Amount classes on metadata mapping loading via loadClassMetadata decreased #6714

Closed
opened 2026-01-22 15:37:25 +01:00 by admin · 1 comment
Owner

Originally created by @SinErgy84 on GitHub (May 12, 2021).

Caution: this issue seems to be related to symfony/dependency-injection changes in https://github.com/symfony/dependency-injection/releases/tag/v4.4.17 because v4.4.16 works as expected

Hi!

I've encountered a problem since the symfony/dependency-injection update to v4.4.17. Maybe I'm wrong to write here, but my problem is related to the loadClassMetadata event from doctrine, so maybe somebody have some clues.

I'm using a symfony subscriber to listen to the loadClassMetadata event, to collect some data from ClassMetadata like association mappings and their target entities, especially for abstract classes and their children.

In my test case with symfony/dependency-injection v4.4.16 the amount of classes on which metadata mapping was loaded was much higher (340 objects in my case) than on v4.4.17 (120 objects). The amount decreased massively and not only the valid classes but their abstract parent classes are missing / are not parsed anymore.

Maybe it's a config setting I'm missing? Do someone else experienced odd behaviour or strange changes in his process?

I have already tried the search in both projects, but since the problem is elusive or due to a specific change, unfortunately I have not found anything so far. I'm very grateful for any hint.

Originally created by @SinErgy84 on GitHub (May 12, 2021). _Caution: this issue seems to be related to symfony/dependency-injection changes in https://github.com/symfony/dependency-injection/releases/tag/v4.4.17 because v4.4.16 works as expected_ Hi! I've encountered a problem since the symfony/dependency-injection update to v4.4.17. Maybe I'm wrong to write here, but my problem is related to the `loadClassMetadata` event from doctrine, so maybe somebody have some clues. I'm using a symfony subscriber to listen to the `loadClassMetadata` event, to collect some data from ClassMetadata like association mappings and their target entities, especially for abstract classes and their children. In my test case with symfony/dependency-injection v4.4.16 the amount of classes on which metadata mapping was loaded was much higher (340 objects in my case) than on v4.4.17 (120 objects). The amount decreased massively and not only the valid classes but their abstract parent classes are missing / are not parsed anymore. Maybe it's a config setting I'm missing? Do someone else experienced odd behaviour or strange changes in his process? I have already tried the search in both projects, but since the problem is elusive or due to a specific change, unfortunately I have not found anything so far. I'm very grateful for any hint.
admin closed this issue 2026-01-22 15:37:26 +01:00
Author
Owner

@beberlei commented on GitHub (May 12, 2021):

Do you require all entities to e loaded? Then you must call $entityManager->getMetadataFactory()->getAllMetadata(); and the cache must be empty. otherwise the amount of loaded metadata is an implementation detail and depends on the request usage and the cache. Changes of this behavior in minor versions is expected, because there is no guarantee a request triggers this event.

@beberlei commented on GitHub (May 12, 2021): Do you require *all* entities to e loaded? Then you must call `$entityManager->getMetadataFactory()->getAllMetadata();` *and* the cache must be empty. otherwise the amount of loaded metadata is an implementation detail and depends on the request usage and the cache. Changes of this behavior in minor versions is expected, because there is no guarantee a request triggers this event.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6714