You are here

public function BcConfigSubscriber::onConfigSave in Drupal 8

Invalidates the service container if serialization BC config gets updated.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event:

File

core/modules/serialization/src/EventSubscriber/BcConfigSubscriber.php, line 45

Class

BcConfigSubscriber
Config event subscriber to rebuild the container when BC config is saved.

Namespace

Drupal\serialization\EventSubscriber

Code

public function onConfigSave(ConfigCrudEvent $event) {
  $saved_config = $event
    ->getConfig();
  if ($saved_config
    ->getName() === 'serialization.settings') {
    if ($event
      ->isChanged('bc_primitives_as_strings') || $event
      ->isChanged('bc_timestamp_normalizer_unix')) {
      $this->kernel
        ->invalidateContainer();
    }
  }
}