public function YamlFileLoader::load

Same name in this branch

Load a YAML file containing service definitions and kernel parameters.

string $filename The name of the file to load.

File

drupal/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php, line 41
Contains \Drupal\Core\DependencyInjection\YamlFileLoader.

Class

YamlFileLoader
YamlFileLoader loads YAML files service definitions.

Namespace

Drupal\Core\DependencyInjection

Code

public function load($filename) {
  $content = $this
    ->loadFile($filename);
  $content += array(
    'parameters' => array(),
    'services' => array(),
  );

  // parameters
  foreach ($content['parameters'] as $key => $value) {
    $this->container
      ->setParameter($key, $this
      ->resolveServices($value));
  }

  // services
  foreach ($content['services'] as $id => $service) {
    $this
      ->parseDefinition($id, $service, $filename);
  }
}