diff --git a/src/Plugin/search_api/processor/AddHierarchy.php b/src/Plugin/search_api/processor/AddHierarchy.php
index abd3e2e..0dd80e4 100644
--- a/src/Plugin/search_api/processor/AddHierarchy.php
+++ b/src/Plugin/search_api/processor/AddHierarchy.php
@@ -48,38 +48,37 @@ class AddHierarchy extends ProcessorPluginBase implements PluginFormInterface {
   protected $entityTypeManager;
 
   /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
-    /** @var static $processor */
-    $processor = parent::create($container, $configuration, $plugin_id, $plugin_definition);
-
-    $processor->setEntityTypeManager($container->get('entity_type.manager'));
-
-    return $processor;
-  }
-
-  /**
-   * Retrieves the entity type manager service.
+   * Creates an AddHierarchy instance.
    *
-   * @return \Drupal\Core\Entity\EntityTypeManagerInterface
-   *   The entity type manager service.
+   * @param array $configuration
+   *   A configuration array containing information about the plugin instance.
+   * @param string $plugin_id
+   *   The plugin_id for the plugin instance.
+   * @param mixed $plugin_definition
+   *   The plugin implementation definition.
+   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+   *   The entity type manager.
    */
-  public function getEntityTypeManager() {
-    return $this->entityTypeManager ?: \Drupal::entityTypeManager();
+  public function __construct(
+    array $configuration,
+    $plugin_id,
+    $plugin_definition,
+    EntityTypeManagerInterface $entity_type_manager
+  ) {
+    parent::__construct($configuration, $plugin_id, $plugin_definition);
+    $this->entityTypeManager = $entity_type_manager;
   }
 
   /**
-   * Sets the entity type manager service.
-   *
-   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
-   *   The entity type manager service.
-   *
-   * @return $this
+   * {@inheritdoc}
    */
-  public function setEntityTypeManager(EntityTypeManagerInterface $entity_type_manager) {
-    $this->entityTypeManager = $entity_type_manager;
-    return $this;
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
+    return new static(
+      $configuration,
+      $plugin_id,
+      $plugin_definition,
+      $container->get('entity_type.manager')
+    );
   }
 
   /**
@@ -280,7 +279,7 @@ public function preprocessIndexItems(array $items) {
   protected function addHierarchyValues($entityTypeId, $entityId, $property, FieldInterface $field) {
     if ("$entityTypeId-$property" == 'taxonomy_term-parent') {
       /** @var \Drupal\taxonomy\TermStorageInterface $entity_storage */
-      $entity_storage = $this->getEntityTypeManager()
+      $entity_storage = $this->entityTypeManager
         ->getStorage('taxonomy_term');
       $parents = [];
       foreach ($entity_storage->loadParents($entityId) as $term) {
@@ -288,7 +287,7 @@ protected function addHierarchyValues($entityTypeId, $entityId, $property, Field
       }
     }
     else {
-      $entity = $this->getEntityTypeManager()
+      $entity = $this->entityTypeManager
         ->getStorage($entityTypeId)
         ->load($entityId);
       $parents = [];
