-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DoctrineBridge] DoctrineLoader relies on AutoMappingTrait #41796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Registering a service with a class that cannot be autoloaded is fine in general, as long as you don't wire it. If you think that this service should not be registered at all, please open an issue here: https://github.com/doctrine/DoctrineBundle/issues If you think that this is a bug of the DependencyInjection component, you're in the right place, however. 🙂 |
You're right I guess. 🙂 My brain was probably assuming that the extension was part of the Though you could argue that the bridge then should either require its dependencies or tolerate missing them? (Not easy with traits, unfortunately.) |
The latter is the case. The bridge is a collection of glue code for various Symfony components. If we made all dependencies mandatory, the bridge would pull a lot of components that you probably don't use. The alternative would be that we have a |
To me it looks like It's just a few lines. Wdyt about pulling the code in to make it more resilient? symfony/src/Symfony/Component/Validator/Mapping/Loader/AutoMappingTrait.php Lines 24 to 33 in e1b81e3
|
That is not correct. The class implements |
Let's fix this over at |
I don't use Validator component in my project but this issue hits me, looks like the loader is loaded anyway. Bumping up |
Symfony version(s) affected: >= 4.4
Description
DoctrineExtension#loadValidatorLoader
registers theDoctrineLoader
as a service. This class uses theSymfony\Component\Validator\Mapping\Loader\AutoMappingTrait
which might not be available.As soon as this service gets autloaded at container build time* this will produce a fatal error under PHP8.1:
*) one scenario is for instance reading class annotations/attributes and thereby calling
$container->getReflectionClass()
How to reproduce
This reminded me a bit of #32395. 🙂 Maybe we could mark the service as synthetic if the
AutoMappingTrait
is not available or register a dummy instead?The text was updated successfully, but these errors were encountered: