You are here

public function SearchApiSolrBackend::calculateDependencies in Search API Solr 8.3

Same name and namespace in other branches
  1. 8 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::calculateDependencies()
  2. 8.2 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::calculateDependencies()
  3. 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::calculateDependencies()

Throws

\Drupal\Component\Plugin\Exception\PluginException

\Drupal\search_api\SearchApiException

Overrides ConfigurablePluginBase::calculateDependencies

File

src/Plugin/search_api/backend/SearchApiSolrBackend.php, line 3704

Class

SearchApiSolrBackend
Apache Solr backend for search api.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

public function calculateDependencies() {

  /** @var \Drupal\Component\Plugin\PluginInspectionInterface $connector */
  $connector = $this
    ->getSolrConnector();
  $this
    ->calculatePluginDependencies($connector);
  $entity_type_manager = \Drupal::entityTypeManager();

  /** @var \Drupal\search_api_solr\Controller\SolrFieldTypeListBuilder $list_builder */
  $field_type_list_builder = $entity_type_manager
    ->getListBuilder('solr_field_type');
  $field_type_list_builder
    ->setBackend($this);
  $solr_field_types = $field_type_list_builder
    ->getEnabledEntities();

  /** @var \Drupal\search_api_solr\Entity\SolrFieldType $solr_field_type */
  foreach ($solr_field_types as $solr_field_type) {
    $this
      ->addDependency('config', $solr_field_type
      ->getConfigDependencyName());
  }

  /** @var \Drupal\search_api_solr\Controller\SolrCacheListBuilder $cache_list_builder */
  $cache_list_builder = $entity_type_manager
    ->getListBuilder('solr_cache');
  $cache_list_builder
    ->setBackend($this);
  $solr_caches = $cache_list_builder
    ->load();
  foreach ($solr_caches as $solr_cache) {
    if (!$solr_cache->disabledOnServer) {
      $this
        ->addDependency('config', $solr_cache
        ->getConfigDependencyName());
    }
  }

  /** @var \Drupal\search_api_solr\Controller\SolrCacheListBuilder $request_handler_list_builder */
  $request_handler_list_builder = $entity_type_manager
    ->getListBuilder('solr_request_handler');
  $request_handler_list_builder
    ->setBackend($this);
  $solr_request_handlers = $request_handler_list_builder
    ->load();
  foreach ($solr_request_handlers as $request_handler) {
    if (!$request_handler->disabledOnServer) {
      $this
        ->addDependency('config', $request_handler
        ->getConfigDependencyName());
    }
  }

  /** @var \Drupal\search_api_solr\Controller\SolrCacheListBuilder $request_dispatcher_list_builder */
  $request_dispatcher_list_builder = $entity_type_manager
    ->getListBuilder('solr_request_dispatcher');
  $request_dispatcher_list_builder
    ->setBackend($this);
  $solr_request_dispatchers = $request_dispatcher_list_builder
    ->load();
  foreach ($solr_request_dispatchers as $request_dispatcher) {
    if (!$request_dispatcher->disabledOnServer) {
      $this
        ->addDependency('config', $request_dispatcher
        ->getConfigDependencyName());
    }
  }
  return $this->dependencies;
}