public function Container::reset
public Container::reset()
Resets shared services from the container.
The container is not intended to be used again after being reset in a normal workflow. This method is meant as a way to release references for ref-counting. A subsequent call to ContainerInterface::get will recreate a new instance of the shared service.
Overrides ResettableContainerInterface::reset
File
- core/lib/Drupal/Component/DependencyInjection/Container.php, line 198
Class
- Container
- Provides a container optimized for Drupal's needs.
Namespace
Drupal\Component\DependencyInjectionCode
public function reset() { if (!empty($this->scopedServices)) { throw new LogicException('Resetting the container is not allowed when a scope is active.'); } $this->services = []; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!DependencyInjection!Container.php/function/Container::reset/8.1.x