diff -u b/core/modules/shortcut/src/ShortcutSetStorage.php b/core/modules/shortcut/src/ShortcutSetStorage.php --- b/core/modules/shortcut/src/ShortcutSetStorage.php +++ b/core/modules/shortcut/src/ShortcutSetStorage.php @@ -9,6 +9,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\Core\Database\Connection; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -22,6 +23,13 @@ * @var \Drupal\Core\Extension\ModuleHandlerInterface */ protected $moduleHandler; + + /** + * The database connection. + * + * @var \Drupal\Core\Database\Connection + */ + protected $database; /** * Constructs a ShortcutSetStorageController object. @@ -37,10 +45,11 @@ * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. */ - public function __construct(EntityTypeInterface $entity_info, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager) { + public function __construct(EntityTypeInterface $entity_info, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager, Connection $database) { parent::__construct($entity_info, $config_factory, $uuid_service, $language_manager); $this->moduleHandler = $module_handler; + $this->database = $database; } /** @@ -52,7 +61,8 @@ $container->get('config.factory'), $container->get('uuid'), $container->get('module_handler'), - $container->get('language_manager') + $container->get('language_manager'), + $container->get('database') ); } @@ -71,7 +81,7 @@ * {@inheritdoc} */ public function assignUser(ShortcutSetInterface $shortcut_set, $account) { - \Drupal::database()->merge('shortcut_set_users') + $this->database->merge('shortcut_set_users') ->key('uid', $account->id()) ->fields(['set_name' => $shortcut_set->id()]) ->execute();