You are here

protected function ConverterBase::writeService in Drupal 7 to 8/9 Module Upgrader 8

Writes a service definition to the target module's services.yml file.

Parameters

TargetInterface $target: The target module.

string $service_id: The service ID. If an existing one with the same ID already exists, it will be overwritten.

array $service_definition:

5 calls to ConverterBase::writeService()
HookBoot::convert in src/Plugin/DMU/Converter/HookBoot.php
Performs required conversions.
HookExit::convert in src/Plugin/DMU/Converter/HookExit.php
Performs required conversions.
HookInit::convert in src/Plugin/DMU/Converter/HookInit.php
Performs required conversions.
HookURLOutboundAlter::convert in src/Plugin/DMU/Converter/HookURLOutboundAlter.php
Performs required conversions.
HookWatchdog::convert in src/Plugin/DMU/Converter/HookWatchdog.php
Performs required conversions.

File

src/ConverterBase.php, line 181

Class

ConverterBase
Base class for converters.

Namespace

Drupal\drupalmoduleupgrader

Code

protected function writeService(TargetInterface $target, $service_id, array $service_definition) {
  $services = $target
    ->getServices();
  $services
    ->set($service_id, $service_definition);
  $this
    ->writeInfo($target, 'services', [
    'services' => $services
      ->toArray(),
  ]);
}