-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] add config option for resetting services #24554
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 1 commit
9dca09b
19ee0b0
6b74c6a
02c90ef
8ae4629
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 |
---|---|---|
|
@@ -56,6 +56,7 @@ | |
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; | ||
use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; | ||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
use Symfony\Component\HttpKernel\EventListener\ServiceResetListener; | ||
use Symfony\Component\Lock\Factory; | ||
use Symfony\Component\Lock\Lock; | ||
use Symfony\Component\Lock\LockInterface; | ||
|
@@ -317,6 +318,10 @@ public function load(array $configs, ContainerBuilder $container) | |
$loader->load('web_link.xml'); | ||
} | ||
|
||
if (!$config['reset_services']) { | ||
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. Instead of registering and removing the service, I'd rather invert that condition and only register the service if the feature has been enabled. 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. Makes sense 👍 |
||
$container->removeDefinition(ServiceResetListener::class); | ||
} | ||
|
||
$this->addAnnotatedClassesToCompile(array( | ||
'**\\Controller\\', | ||
'**\\Entity\\', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
$container->loadFromExtension('framework', array( | ||
'reset_services' => true, | ||
)); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" ?> | ||
|
||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:framework="http://symfony.com/schema/dic/symfony" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd | ||
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> | ||
|
||
<framework:config reset-services="true" /> | ||
</container> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
framework: | ||
reset_services: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any better idea for the name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reset_services_on_terminate?
no more comment :)