- class ContainerBuilder extends SymfonyContainerBuilder {
- + protected $explicitlySet = [];
- +
- /**
- * {@inheritdoc}
- */
- @@ -44,6 +48,7 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER) {
- if (strtolower($id) !== $id) {
- throw new \InvalidArgumentException("Service ID names must be lowercase: $id");
- }
- + $this->explicitlySet[$id] = TRUE;
- SymfonyContainer::set($id, $service, $scope);
- // Ensure that the _serviceId property is set on synthetic services as well.
- @@ -100,6 +105,17 @@ private function synchronize($id) {
- }
- /**
- + * {@inheritdoc}
- + */
- + public function compile() {
- + parent::compile();
- + // Remove all non-synthetic services set by compiler passes. For example,
- + // cache bins are forced to NulLBackend before the ListCacheBinsPass and
- + // so cache services might got stored as NullBackend.
- + $this->services = array_intersect_key($this->services, $this->explicitlySet);
- + }
- +
- + /**
- * A 1to1 copy of parent::callMethod.
- */
- protected function callMethod($service, $call) {