I'm interested in Symfony\Component\HttpKernel\DependencyInjection\Extension::getAnnotatedClassesToCompile()
method. If I understand it correctly, you can addAnnotatedClassesToCompile()
an array of classes (which uses annotations) namespaces. Then during cache warmup all these classes annotations become warmed up. Am I right or something is missing?
If its correct, then why symfony adds Symfony\Bundle\FrameworkBundle\Controller\AbstractController
, Symfony\Bundle\FrameworkBundle\Controller\Controller
to annotated classes? I cant find any annotations in it...
https://symfony.com/doc/current/bundles/extension.html#adding-classes-to-compile
As your controllers will extend
Controller
orAbstractController
that means these will always be checked for annotations so it makes sense to cache the fact they have none. Adding them toaddAnnotatedClassesToCompile
ensures this is done even if you didn't dump an optimized autoloader.