diff --git a/src/Controller/EditionsController.php b/src/Controller/EditionsController.php
index e4db2f6..3b0c23d 100644
--- a/src/Controller/EditionsController.php
+++ b/src/Controller/EditionsController.php
@@ -5,9 +5,13 @@
 
 namespace Drupal\simplenews_scheduler\Controller;
 
+use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Controller\ControllerBase;
+use Drupal\Core\Database\Connection;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Session\AccountProxyInterface;
 use Drupal\node\NodeInterface;
-use Drupal\Core\Access\AccessResult;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Default controller for the simplenews_scheduler module.
@@ -15,11 +19,59 @@ use Drupal\Core\Access\AccessResult;
 class EditionsController extends ControllerBase {
 
   /**
+   * The entity manager.
+   *
+   * @var \Drupal\Core\Entity\EntityManagerInterface
+   */
+  protected $entityManager;
+
+  /**
+   * The current user.
+   *
+   * @var \Drupal\Core\Session\AccountProxyInterface
+   */
+  protected $currentUser;
+
+  /**
+   * The database connection.
+   *
+   * @param \Drupal\Core\Database\Connection
+   */
+  protected $database;
+
+  /**
+   * Creates the EditionsController object.
+   *
+   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
+   *   The entity manager.
+   * @param \Drupal\Core\Session\AccountProxyInterface $current_user
+   *   The current user.
+   * @param \Drupal\Core\Database\Connection $database
+   *   The database connection.
+   */
+  public function __construct(EntityManagerInterface $entity_manager, AccountProxyInterface $current_user, Connection $database) {
+    $this->entityManager = $entity_manager;
+    $this->currentUser = $current_user;
+    $this->database = $database;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function creat(ContainerInterface $container) {
+    return new static(
+      $container->get('entity.manager'),
+      $container->get('current_user'),
+      $container->get('database')
+    );
+  }
+
+  /**
    * Check whether to display the Scheduled Newsletter tab.
    */
   public function checkAccess(NodeInterface $node) {
     // Check if this is a simplenews node type and permission.
-    if ($node->hasField('simplenews_issue') && $node->simplenews_issue->target_id != NULL && \Drupal::currentUser()->hasPermission('overview scheduled newsletters')) {
+    if ($node->hasField('simplenews_issue') && $node->simplenews_issue->target_id != NULL && $this->currentUser->hasPermission('overview scheduled newsletters')) {
       // Check if this is either a scheduler newsletter or an edition.
       return AccessResult::allowedIf(!empty($node->simplenews_scheduler) || !empty($node->is_edition));
     }
@@ -59,7 +111,7 @@ class EditionsController extends ControllerBase {
       $output['prefix']['#markup'] = '<p>' . t('This is a newsletter template node of which all corresponding editions nodes are based on.') . '</p>';
 
       // Load the corresponding editions from the database to further process.
-      $result = db_select('simplenews_scheduler_editions', 's')
+      $result = $this->database->select('simplenews_scheduler_editions', 's')
         ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
         ->limit(20)
         ->fields('s')
@@ -68,7 +120,7 @@ class EditionsController extends ControllerBase {
         ->fetchAll();
 
       foreach ($result as $row) {
-        $node = \Drupal::entityManager()->getStorage('node')->load($row->eid);
+        $node = $this->entityManager->getStorage('node')->load($row->eid);
         $rows[] = array($node->link(), format_date($row->date_issued, 'custom', 'Y-m-d H:i'));
       }
 
@@ -84,7 +136,7 @@ class EditionsController extends ControllerBase {
       $output['pager'] = array('#type' => 'pager');
     }
     else { // This is a newsletter edition.
-      $master_node = \Drupal::entityManager()->getStorage('node')->load($nid);
+      $master_node = $this->entityManager->getStorage('node')->load($nid);
       $output['prefix']['#markup'] = '<p>' . t('This node is part of a scheduled newsletter configuration. View the original newsletter <a href="@parent">here</a>.', array('@parent' => $master_node->url())) . '</p>';
 
     }
