3 namespace Drush\Drupal;
5 use Drush\Log\LogLevel;
6 use Drupal\Core\DependencyInjection\ServiceModifierInterface;
7 use Drupal\Core\DependencyInjection\ContainerBuilder;
9 class DrushServiceModifier implements ServiceModifierInterface
14 public function alter(ContainerBuilder $container) {
15 drush_log(dt("service modifier alter"), LogLevel::DEBUG);
16 // http://symfony.com/doc/2.7/components/dependency_injection/tags.html#register-the-pass-with-the-container
17 $container->register('drush.service.consolecommands', 'Drush\Command\ServiceCommandlist');
18 $container->addCompilerPass(new FindCommandsCompilerPass('drush.service.consolecommands', 'drush.command'));
19 $container->register('drush.service.consolidationcommands', 'Drush\Command\ServiceCommandlist');
20 $container->addCompilerPass(new FindCommandsCompilerPass('drush.service.consolidationcommands', 'consolidation.commandhandler'));
23 * Checks existing service definitions for the presence of modification.
25 * @param $container_definition
26 * Cached container definition
29 public function check($container_definition) {
30 return isset($container_definition['services']['drush.service.consolecommands']) &&
31 isset($container_definition['services']['drush.service.consolidationcommands']);