Skip to content

Commit

Permalink
[FrameworkBundle] Added Kernel::reset() and Console\Application::reset()
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed Jul 8, 2019
1 parent 6811aaa commit 3d1a6fa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/Console/Application.php
Expand Up @@ -55,6 +55,14 @@ public function getKernel()
return $this->kernel;
}

/**
* @see Symfony\Contracts\Service\ResetInterface
*/
public function reset()
{
$this->kernel->reset();
}

/**
* Runs the current application.
*
Expand Down
10 changes: 9 additions & 1 deletion src/Symfony/Component/HttpKernel/Kernel.php
Expand Up @@ -36,6 +36,7 @@
use Symfony\Component\HttpKernel\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\AddAnnotatedClassesToCachePass;
use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
use Symfony\Contracts\Service\ResetInterface;

/**
* The Kernel is the heart of the Symfony system.
Expand All @@ -47,7 +48,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*/
abstract class Kernel implements KernelInterface, RebootableInterface, TerminableInterface
abstract class Kernel implements KernelInterface, RebootableInterface, TerminableInterface, ResetInterface
{
/**
* @var BundleInterface[]
Expand Down Expand Up @@ -150,6 +151,13 @@ public function reboot($warmupDir)
$this->boot();
}

public function reset()
{
if ($this->container->has('services_resetter')) {
$this->container->get('services_resetter')->reset();
}
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit 3d1a6fa

Please sign in to comment.