Commit 7432acc1 authored by Oleksandr Kuzava's avatar Oleksandr Kuzava
Browse files

Issue #3276794 by nginex: Cant install Targets because of uncaught PHP Exception

parent 5c9b5e9b
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -42,11 +42,11 @@ class PathProcessorTarget implements InboundPathProcessorInterface, OutboundPath
  protected $configFactory;

  /**
   * The target storage.
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityStorageInterface
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $targetStorage;
  protected $entityTypeManager;

  /**
   * PathProcessorTarget constructor.
@@ -64,7 +64,7 @@ class PathProcessorTarget implements InboundPathProcessorInterface, OutboundPath
    $this->targetManager = $target_manager;
    $this->languageManager = $language_manager;
    $this->configFactory = $config_factory;
    $this->targetStorage = $entity_type_manager->getStorage('target');
    $this->entityTypeManager = $entity_type_manager;
  }

  /**
@@ -124,7 +124,9 @@ class PathProcessorTarget implements InboundPathProcessorInterface, OutboundPath
      $node_target_id = $options['entity']->get('target')->value;

      if ($node_target_id !== TargetInterface::ALL_TARGETS) {
        $options['target'] = $this->targetStorage->load($node_target_id);
        $options['target'] = $this->entityTypeManager
          ->getStorage('target')
          ->load($node_target_id);
      }
    }