You are here

public function ServiceContainerServiceProvider::getContainerDefinition in Service Container 7.2

Same name in this branch
  1. 7.2 src/ServiceContainer/ServiceProvider/ServiceContainerServiceProvider.php \Drupal\service_container\ServiceContainer\ServiceProvider\ServiceContainerServiceProvider::getContainerDefinition()
  2. 7.2 tests/modules/service_container_test_ctools/src/ServiceContainer/ServiceProvider/ServiceContainerServiceProvider.php \Drupal\service_container_test_ctools\ServiceContainer\ServiceProvider\ServiceContainerServiceProvider::getContainerDefinition()
  3. 7.2 tests/modules/service_container_test/src/ServiceContainer/ServiceProvider/ServiceContainerServiceProvider.php \Drupal\service_container_test\ServiceContainer\ServiceProvider\ServiceContainerServiceProvider::getContainerDefinition()
Same name and namespace in other branches
  1. 7 src/ServiceContainer/ServiceProvider/ServiceContainerServiceProvider.php \Drupal\service_container\ServiceContainer\ServiceProvider\ServiceContainerServiceProvider::getContainerDefinition()

Gets a service container definition.

Return value

array Returns an associative array with the following keys:

  • parameters: Simple key-value store of container parameters
  • services: Services like defined in services.yml

factory methods, arguments and tags are supported for services.

@see core.services.yml in Drupal 8

Overrides ServiceProviderInterface::getContainerDefinition

1 method overrides ServiceContainerServiceProvider::getContainerDefinition()
ServiceContainerAnnotationDiscoveryServiceProvider::getContainerDefinition in modules/providers/service_container_annotation_discovery/src/ServiceContainer/ServiceProvider/ServiceContainerAnnotationDiscoveryServiceProvider.php
Gets a service container definition.

File

src/ServiceContainer/ServiceProvider/ServiceContainerServiceProvider.php, line 25
Contains \Drupal\service_container\ServiceContainer\ServiceProvider\ServiceContainerServiceProvider

Class

ServiceContainerServiceProvider
Provides render cache service definitions.

Namespace

Drupal\service_container\ServiceContainer\ServiceProvider

Code

public function getContainerDefinition() {
  $parameters = array();
  $parameters['service_container.static_event_listeners'] = array();
  $parameters['service_container.plugin_managers'] = array();
  $parameters['service_container.plugin_manager_types'] = array(
    'ctools' => '\\Drupal\\service_container\\Plugin\\Discovery\\CToolsPluginDiscovery',
  );
  $services = array();
  $services['drupal7'] = array(
    'class' => 'Drupal\\service_container\\Legacy\\Drupal7',
  );
  $services['service_container'] = array(
    'class' => '\\Drupal\\service_container\\DependencyInjection\\Container',
  );
  $services['module_handler'] = array(
    'class' => '\\Drupal\\service_container\\Extension\\ModuleHandler',
    'arguments' => array(
      DRUPAL_ROOT,
      '@drupal7',
    ),
  );
  $services['module_installer'] = array(
    'class' => '\\Drupal\\service_container\\Extension\\ModuleInstaller',
    'arguments' => array(
      '@drupal7',
    ),
  );
  $services['database'] = array(
    'class' => 'Drupal\\Core\\Database\\Connection',
    'factory' => 'Drupal\\Core\\Database\\Database::getConnection',
    'arguments' => array(
      'default',
    ),
  );
  $services['flood'] = array(
    'class' => '\\Drupal\\service_container\\Flood\\LegacyBackend',
    'arguments' => array(
      '@database',
      '@drupal7',
    ),
    'tags' => array(
      array(
        'name' => 'backend_overridable',
      ),
    ),
  );
  $services['serialization.phpserialize'] = array(
    'class' => 'Drupal\\Component\\Serialization\\PhpSerialize',
  );
  $parameters['factory.keyvalue'] = array();
  $parameters['factory.keyvalue.expirable'] = array();
  $services['keyvalue'] = array(
    'class' => 'Drupal\\service_container\\KeyValueStore\\KeyValueFactory',
    'arguments' => array(
      '@service_container',
      '%factory.keyvalue%',
    ),
  );
  $services['keyvalue.database'] = array(
    'class' => 'Drupal\\Core\\KeyValueStore\\KeyValueDatabaseFactory',
    'arguments' => array(
      '@serialization.phpserialize',
      '@database',
    ),
  );
  $services['keyvalue.expirable'] = array(
    'class' => '\\Drupal\\service_container\\KeyValueStore\\KeyValueExpirableFactory',
    'arguments' => array(
      '@service_container',
      '%factory.keyvalue.expirable%',
    ),
  );
  $services['keyvalue.expirable.database'] = array(
    'class' => 'Drupal\\service_container\\KeyValueStore\\KeyValueDatabaseExpirableFactory',
    'arguments' => array(
      '@serialization.phpserialize',
      '@database',
    ),
    'tags' => array(
      array(
        'name' => 'needs_destruction',
      ),
    ),
  );
  $services['state'] = array(
    'class' => 'Drupal\\Core\\State\\State',
    'arguments' => array(
      '@keyvalue',
    ),
  );
  $services['variable'] = array(
    'class' => 'Drupal\\service_container\\Variable',
    'arguments' => array(
      '@drupal7',
    ),
  );
  $services['lock'] = array(
    'class' => 'Drupal\\Core\\Lock\\DatabaseLockBackend',
    'arguments' => array(
      '@database',
    ),
    'tags' => array(
      array(
        'name' => 'backend_overridable',
      ),
    ),
  );
  $services['lock.persistent'] = array(
    'class' => 'Drupal\\Core\\Lock\\PersistentDatabaseLockBackend',
    'arguments' => array(
      '@database',
    ),
    'tags' => array(
      array(
        'name' => 'backend_overridable',
      ),
    ),
  );
  $services['messenger'] = array(
    'class' => 'Drupal\\service_container\\Messenger\\LegacyMessenger',
    'arguments' => array(
      '@drupal7',
    ),
  );
  $services['url_generator'] = array(
    'class' => 'Drupal\\service_container\\UrlGenerator',
    'arguments' => array(
      '@drupal7',
    ),
  );
  $services['link_generator'] = array(
    'class' => 'Drupal\\service_container\\LinkGenerator',
    'arguments' => array(
      '@drupal7',
    ),
  );
  $services['current_user'] = array(
    'class' => 'Drupal\\service_container\\Session\\Account',
    'arguments' => array(
      '@drupal7',
      '@variable',
    ),
  );

  // Logging integration.
  $services['logger.factory'] = array(
    'class' => 'Drupal\\service_container\\Logger\\LoggerChannelFactory',
    'calls' => array(
      array(
        'addLogger',
        array(
          '@logger.dblog',
        ),
      ),
    ),
  );
  $services['logger.dblog'] = array(
    'class' => 'Drupal\\service_container\\Logger\\WatchdogLogger',
    'arguments' => array(
      '@drupal7',
    ),
    'tags' => array(
      array(
        'name' => 'logger',
      ),
    ),
  );
  $services['logger.channel.default'] = array(
    'class' => 'Drupal\\service_container\\Logger\\LoggerChannel',
    'factory' => array(
      '@logger.factory',
      'get',
    ),
    'arguments' => array(
      'system',
    ),
  );
  $services['logger.channel.php'] = array(
    'class' => 'Drupal\\service_container\\Logger\\LoggerChannel',
    'factory' => array(
      '@logger.factory',
      'get',
    ),
    'arguments' => array(
      'php',
    ),
  );
  $services['logger.channel.cron'] = array(
    'class' => 'Drupal\\service_container\\Logger\\LoggerChannel',
    'factory' => array(
      '@logger.factory',
      'get',
    ),
    'arguments' => array(
      'cron',
    ),
  );
  return array(
    'parameters' => $parameters,
    'services' => $services,
  );
}