-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel][DI] allow bundles to declare classes that should be preloaded #33689
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -453,6 +453,37 @@ public function load(array $configs, ContainerBuilder $container) | |
|
||
$container->registerForAutoconfiguration(RouteLoaderInterface::class) | ||
->addTag('routing.route_loader'); | ||
|
||
$this->addClassesToPreload([ | ||
'Psr\Log\LogLevel', | ||
'Symfony\Component\Cache\Adapter\ApcuAdapter', | ||
'Symfony\Component\Cache\Adapter\ArrayAdapter', | ||
'Symfony\Component\Cache\Adapter\PhpArrayAdapter', | ||
'Symfony\Component\Cache\Adapter\PhpFilesAdapter', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't these discovered thanks to services already ? |
||
'Symfony\Component\Cache\CacheItem', | ||
'Symfony\Component\DependencyInjection\Argument\RewindableGenerator', | ||
'Symfony\Component\DependencyInjection\Argument\ServiceLocator', | ||
'Symfony\Component\DependencyInjection\ContainerAwareInterface', | ||
'Symfony\Component\DependencyInjection\ContainerAwareTrait', | ||
'Symfony\Component\Dotenv\Dotenv', | ||
'Symfony\Component\ErrorHandler\ErrorHandler', | ||
'Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy', | ||
'Symfony\Component\HttpFoundation\AcceptHeader', | ||
'Symfony\Component\HttpFoundation\AcceptHeaderItem', | ||
'Symfony\Component\HttpFoundation\FileBag', | ||
'Symfony\Component\HttpFoundation\HeaderBag', | ||
'Symfony\Component\HttpFoundation\HeaderUtils', | ||
'Symfony\Component\HttpFoundation\ParameterBag', | ||
'Symfony\Component\HttpFoundation\ResponseHeaderBag', | ||
'Symfony\Component\HttpFoundation\ServerBag', | ||
nicolas-grekas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
'Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent', | ||
'Symfony\Component\HttpKernel\Event\ControllerEvent', | ||
'Symfony\Component\HttpKernel\Event\TerminateEvent', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about RequestEvent and ResponseEvent ? |
||
'Symfony\Component\HttpKernel\KernelEvents', | ||
'Symfony\Component\VarExporter\Internal\Hydrator', | ||
'Symfony\Component\VarExporter\Internal\Registry', | ||
'Symfony\Component\WebLink\HttpHeaderSerializer', | ||
]); | ||
} | ||
|
||
/** | ||
|
@@ -850,6 +881,15 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co | |
|
||
$loader->load('routing.xml'); | ||
|
||
$this->addClassesToPreload([ | ||
'Symfony\Bundle\FrameworkBundle\Routing\RedirectableCompiledUrlMatcher', | ||
'Symfony\Component\Routing\Annotation\Route', | ||
nicolas-grekas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
'Symfony\Component\Routing\Matcher\CompiledUrlMatcher', | ||
'Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherTrait', | ||
'Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface', | ||
|
||
]); | ||
|
||
if ($config['utf8']) { | ||
$container->getDefinition('routing.loader')->replaceArgument(2, ['utf8' => true]); | ||
} | ||
|
@@ -901,6 +941,14 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c | |
{ | ||
$loader->load('session.xml'); | ||
|
||
$this->addClassesToPreload([ | ||
'Symfony\Component\HttpFoundation\Session\SessionBagProxy', | ||
'Symfony\Component\HttpFoundation\Session\Storage\Handler\AbstractSessionHandler', | ||
'Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler', | ||
'Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy', | ||
'Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', | ||
]); | ||
|
||
// session storage | ||
$container->setAlias('session.storage', $config['storage_id'])->setPrivate(true); | ||
$options = ['cache_limiter' => '0']; | ||
|
@@ -1118,6 +1166,10 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder | |
|
||
$loader->load('translation.xml'); | ||
|
||
$this->addClassesToPreload([ | ||
'Symfony\Component\Translation\Formatter\IntlFormatter', | ||
]); | ||
|
||
// Use the "real" translator instead of the identity default | ||
$container->setAlias('translator', 'translator.default')->setPublic(true); | ||
$container->setAlias('translator.formatter', new Alias($config['formatter'], false)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,6 +170,18 @@ public function load(array $configs, ContainerBuilder $container) | |
$container->removeDefinition('twig.cache_warmer'); | ||
$container->removeDefinition('twig.template_cache_warmer'); | ||
} | ||
|
||
$this->addClassesToPreload([ | ||
'Symfony\Component\Stopwatch\Section', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't it be added by FrameworkBundle when defining the stopwatch service instead ? Thus, I don't think we use it in prod code. |
||
'Twig\Cache\FilesystemCache', | ||
'Twig\Extension\CoreExtension', | ||
'Twig\Extension\EscaperExtension', | ||
'Twig\Extension\OptimizerExtension', | ||
'Twig\Extension\StagingExtension', | ||
'Twig\ExtensionSet', | ||
'Twig\Template', | ||
'Twig\TemplateWrapper', | ||
]); | ||
} | ||
|
||
private function getBundleTemplatePaths(ContainerBuilder $container, array $config) | ||
|
Uh oh!
There was an error while loading. Please reload this page.