Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 3.3.0-dev |
Using Symfony 3.3.0-dev + "jms/di-extra-bundle": "dev-master" got an error:
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
You have requested a non-existent service "cache.annotations".
Problem is that DiExtraBundle AnnotationConfigurationPass is using annotation reader service which uses "cache.annotations" and they are instantiated in AnnotationConfigurationPass.
After that "cache.annotations" definition no longer available as it's already instantiated.
Now CachePoolClearerPass uses has('cache.annotations') and then getDefinition('cache.annotations') (see: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php#L55 )
has('cache.annotations') returns true, because it has that service, but getDefinition() now throws exception because no definition exists.
DiExtraBundle is registering AnnotationConfigurationPass in before optimization pass and FrameworkBundle's CachePoolClearerPass is registered in after removing pass.
Maybe we could rearrange these Passes, or it would be safe to patch CachePoolClearerPass to use not has() but hasDefinition() instead? In this case, users who uses DiExtra bundle won't get 'monolog.logger.cache' inserted into 'cache.annotations' so don't know is this also good option.
What's your thoughts?